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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

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
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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

Top Solution Authors