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
Anonymous
Not applicable

Calculate a single measure using values with different filters

Hi,

 

I'm trying to do something which I think should be relatively simple but I'm struggling to do it Power BI.

 

I have data covering students taking various undergraduate study courses. The data also contain columns with details of subsequent postgraduates courses if the student continues their studies, which are blank otherwise.

 

I'm trying to create a summary of the data as shown in the screenshot. The first three boxes have simple calculations and I've edited the interactions so that the value in 'Postgraduate Course' slicer does not interfere with them.

 

The value I'm struggling to calculate is for the box on the bottom right. This value should be = Number of students taking the specified undergraduate and postgraduate courses/ Number of students taking the specified undergraduate course i.e. 9/642 = 1.40%. Unfortunately, by setting the second slicer ('Postgraduate Course') I filter the records and end up with a value of 100%.

 

PBI Screenshot2.PNG 

I understand that the measure will require different filters for the numerator and denominator of the calculation. Is it possible to do this in Power BI, and to do it in a dynamic way so that the values update based on the selections in the slicers (i.e. without creating a pre-computed table of all combinations)?

 

Thanks in advance 

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi, it sounds like you'll likely need to use an ALL() statement for the denominator. It would look like this:

 

Measure = 
DIVIDE(
[Graduate Count (Specified)],
CALCULATE([Undergraduate Count], ALL(table[post graduate course])
)

 

This will clear the filter context of the 2nd slicer only and only for the denominator, and allow the other slicers to affect the data.

 

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

Hi, it sounds like you'll likely need to use an ALL() statement for the denominator. It would look like this:

 

Measure = 
DIVIDE(
[Graduate Count (Specified)],
CALCULATE([Undergraduate Count], ALL(table[post graduate course])
)

 

This will clear the filter context of the 2nd slicer only and only for the denominator, and allow the other slicers to affect the data.

 

Anonymous
Not applicable

Hi @Anonymous,

 

Thank you for your response - that solution worked perfectly!

 

Just an extension question - I want to add another two overlapping slicer for the Faculties which would help refine the sets for the Undergraduate and Postgraduate courses. The problem I have is that the conversion calculation then doesn't work when anything from the Faculty slicer is selected. I have an example I can share to demonstrate the issue, otherwise I can explain it in more detail if more information is needed.

Anonymous
Not applicable

Has this problem been addressed? Can you send the example and I can give you my best solution?

Anonymous
Not applicable

Hi @Anonymous ,

 

Yes, it was actually really simple. I didn't realise that you can provide two parameters to the ALL command - this was all I needed to solve the problem.

 

Thank you for chasing this up.

 

Best Wishes,

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