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

Measure to calculate % for a selected slicer

Hi everyone!

 

So my question is about how to create a measure that calculates the percentage of revenue respect the total revenue of the year selected. Here is an example of the data:

Capture.PNG

 

 

OK so I have 4 different slicers. One for each category and year. So what I want to show is the % of the revenue respect the year/years selected in the revenue. For example: if I filter for 2018, the total is €105. So if afterwards I filter by category I want to see the % of the categories I selected respect the total of 2018. 

 

The result will be to show a card with the percentage of 2018 (if I select 2018 in the slicer):

 

100% if only 2018 is selected

57.14% if 2018 and A7 is selected

100% if 2017 and 2018 is selected

27.27% if 2017/2018/B4 is selected

And so on...

 

The objective it to show the % of the revenue respect the year/s selected.

 

Sorry if I didn't explain myself very well...

 

If you have any doubt with the context I'll be very pleased to help you.

 

Thank you so much in advance!

 

Enzo

 

1 ACCEPTED SOLUTION
Greg_Deckler
Super User
Super User

You want to use CALCULATETABLE. CALCULATETABLE allows you to feed it filters and only those filters are modified from the original context. You can see how this works in my Time Intelligence The Hard Way Quick Measure here:

 

https://community.powerbi.com/t5/Quick-Measures-Gallery/Time-Intelligence-quot-The-Hard-Way-quot-TIT...


@ 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!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

2 REPLIES 2
Greg_Deckler
Super User
Super User

You want to use CALCULATETABLE. CALCULATETABLE allows you to feed it filters and only those filters are modified from the original context. You can see how this works in my Time Intelligence The Hard Way Quick Measure here:

 

https://community.powerbi.com/t5/Quick-Measures-Gallery/Time-Intelligence-quot-The-Hard-Way-quot-TIT...


@ 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!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Thank you so much Greg!

 

Your post was very helpful. Finally, I solved my problem.

 

Best regards,

 

Enzo

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.