Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
ManjunathaEP
Helper II
Helper II

Total not showing for Measure

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

ManjunathaEP_1-1618580878445.png

 

I calculated the measures:

1. Sales = SUM(Data[Sales])
2. Sales previous year =
VAR currentyear = MAX(Years[Year])
RETURN
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
ManjunathaEP_2-1618581071584.png

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

ManjunathaEP_3-1618581213482.png

Please help me on this.

 
1 REPLY 1
Anonymous
Not applicable

@ManjunathaEP 

 

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

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.