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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
leorrn
New Member

Create Total by subgroup+ Difference + % using the new DAX function Window

Hello guys how are you?

 

Here is one example of my PBI (simple one, with sales by country per day)

 

leorrn_0-1680028684570.png

I'm looking forward to (using the new DAX window function): 

  1. add a total by Continent per day
  2. add the difference per continent per day
  3. add a %

Example of the desired final result (in Excel)

leorrn_1-1680029198674.png

 

Here are the:

  • Excel used as Data Source (and the final result) - link
  • PBI file - link

Really appreciate

 

Leo

2 REPLIES 2
Jihwan_Kim
Super User
Super User

Hi,

Please check the below picture and the attached pbix file, whether it works for you.

 

Jihwan_Kim_0-1680059919165.png

 

 

Sales: = 
SUM( Tabela1[Sales] )

 

Diff: = 
CALCULATE ( [Sales:], Tabela1[Group] = "Americas" )
    - CALCULATE ( [Sales:], Tabela1[Group] = "Europe" )

 

Percentage: = 
DIVIDE( [Diff:], CALCULATE([Sales:], Tabela1[Group] = "Americas"))

 

 

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Go to My LinkedIn Page


Hello Kim, ty for the fast reply. I've done something similar to what you suggested. In 2 separated visuals, etc. 

 

The issue is that sometimes we have more Countries per Region, and the tables do not fit well. 

 

That's why I considered using the new window function (similar to Tableau table calculations). So, independent of how many countries the table shows, the final calculations would fit well in the same table)

 

TYVM

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors