Showing results for 
Search instead for 
Did you mean: 
Helper I
Helper I

Total not showing for Measure

Hi, Thank you in advance for helping me to solve with DAX for the below sample.



I calculated the measures:

1. Sales = SUM(Data[Sales])
2. Sales previous year =
VAR currentyear = MAX(Years[Year])
CALCULATE( [Sales], Years[Year] = currentyear-1)
4. Diff = [Sales]-[Sales previous year]
3. lost = IF(-[Diff]=[Sales previous year],[Diff],BLANK()) 
I got the results without "Totals" and I would like to get the totals for the below table

Also, I did not get the results by Year for the measure selection of "Lost" as shown in the below screenshot.


Please help me on this.

Solution Sage
Solution Sage



I'll give you a hint: You should use the standard building blocks of Power BI, not invent your own. Please read this first Time Intelligence in Power BI Desktop - SQLBI. Each sensible model should have a proper Date table as a dimension. If you don't need to expose a set of columns from it, you can hide them. But you should use what you've been given out of the box.


Now, why the heck would you write code like this: -[Diff]=[Sales previous year]? Since [Sales]-[Sales previous year] = [Diff], is it not simpler and more understandable to just write [Sales] = 0? Why would you want to complicate simple things?


Last thing... If you want to also have totals, you have to sum up the quantities of interest over the set of visible customers.

Helpful resources

PBI User Groups

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

Top Solution Authors
Top Kudoed Authors