Calculate

  • Filter context is contextual data that can be filtered by. This can be a column of values in a data model (filter context) or a category in a visual (visual filter context)

  • Row context creation (iteration) means that Power BI will no longer calculate the total or max of a single column but will now calculate its expression per row. It then overlays an overarching base expression, such as SUM, on top of this outcome. By calculating per row (iteration) instead of applying a calculation to one column, filter context is included. Even where no filter context was present in the first place.

  • Filter context creation means that Power BI opens the possibility to modify and/or filter already existing filter context (such as a category in a visual).

The CALCULATE expression is perhaps the most important expression in the DAX library. The CALCULATE expression can be used to modify existing filter context or to add new filter context.

In the example below, the base expression SUM was initially used. The expression SUM takes one column and calculates the total. Filter context is not indicated unless this is visually specified as in the image below.

To be able to modify the table below, for example you want to see the total for all customers, you only want to see customer A, or you want to use a different contact than the already existing contact, then filter context must be added or adjusted. This can be done by placing CALCULATE in front of the SUM. In addition to the ‘expression’ option such as SUM, the ‘filter’ option is then created. With the ‘filter’ option, the filter context can be adjusted and added.

Sharing is caring!

Twitter
LinkedIn
WhatsApp
Email
Threads

Have a look at my other blogs

ISFILTERED

You probably know that the ISFILTERED function returns TRUE when the specified table or column is being filtered directly. But did you know that if you add multiple ISFILTEREDs together, ISFILTERED will not return true or false, but will return a number. You can combine this returned number with a switch function to influence your total levels.

Read More ...

Un-Bold Row Headers

Have you ever created a matrix visual, with hierarchy, where your row headers are formatted 𝐛𝐨𝐥𝐝? You can not seem to turn if off, because

Read More ...

Alignment of visuals

Have you ever heard of the “Align” button? It helps you to align visuals, no more precision drag-and-drop…

It also helps to distribute visuals horizontally of vertically over a canvas. This will give an overall alignment of visuals which would make your report so much cleaner.

Read More ...

Discover more from

Subscribe now to keep reading and get access to the full archive.

Continue reading