15.2Deciding what the “Total” row shows

Sometimes, no total makes sense in your visual. Sometimes, you need a different one. Then test whether the measure is on a row or on the total.

15.2.1Testing the current row

Let us place this measure in a table by city. HASONEVALUE answers TRUE when a single city is visible, so on the city rows, and FALSE on the “Total” row:

Displayed Bonus = IF( HASONEVALUE( Customers[City] ), [Bonus], BLANK() )
Power BI accepts this DAX foryes, Measureyes, Calculated columnno, Calculated tableno, Virtual table
In plain words

“I want the bonus if only one city is left, and nothing otherwise.”

Table visual, The “Displayed Bonus” measure by city
CityDisplayed Bonus
New York90,000
Chicago50,000
Toronto0
Total

This is a reproduction of the Power BI interface for teaching purposes. It differs from the real interface.

The “Total” row stays blank. Instead of BLANK(), you can write any other calculation, like the “Total Bonus” measure.

The rest of this lesson is part of izyDAX Pro

You have just read the first section. The next one, its animations, the exercises and the summary are waiting for you with izyDAX Pro, in a single payment.