cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
ManjunathaEP
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.

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
daxer
Solution Sage
Solution Sage

@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
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