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
RobinLindstroem
Frequent Visitor

DAX CALCULATION % OF SALES

Hi guys, 

 

I do not get this to work.

 

I have created a hiearchy where the top level shows SALES, COGS,  PERSONNEL COSTS, OTHER EXTERNAL COSTS.

 

If you drill down, you can see all the accountnumbers tied to these classificaitons.

 

I am trying to create a DAX calculation which shows the % of Sales.

 

"% of Sales = SUM(Table1[Sales]) / CALCULATE(SUM(Table1[Sales]); Table1[Type] = "SALES")"

 

However, this works when looking at the top level, but when drilling down it no longer works.

 

Any ideas?? 🙂

P&L2.pngP&L.png

 

1 ACCEPTED SOLUTION

Putting the SUM in the values area, and "Show as percent of" grand total works. But I want to "show percent of" Sales which is the top row called "1. Intäkter".

 

So I put SUM in the values field and then I choose "show percent"  of  "1. Intäkter" a.k.a Sales.

 

This works until you want to drill down in the pivot table 😕

Thanks for trying to help!

View solution in original post

2 REPLIES 2
Greg_Deckler
Super User
Super User

I would try just a simple SUM and then in the values area click the drop down on the field and choose "Show as" | "Percent of grand total". Otherwise, I would try:

 

% of Sales = SUM(Table1[Sales]) / CALCULATE(SUM(Table1[Sales]); ALLEXCEPT(Table1,[Type]))

@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Mastering Power BI 2nd Edition

DAX is easy, CALCULATE makes DAX hard...

Putting the SUM in the values area, and "Show as percent of" grand total works. But I want to "show percent of" Sales which is the top row called "1. Intäkter".

 

So I put SUM in the values field and then I choose "show percent"  of  "1. Intäkter" a.k.a Sales.

 

This works until you want to drill down in the pivot table 😕

Thanks for trying to help!

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.