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

Difference between two percentages using a filtered percentage and 'all sample' percentage

Hi everyone,

 

I have a survey which I am producing a report for and I would like to show the % difference between a filtered total of responses and a 'total sample' measure. For example:

 

Age RangeResponses filtered by various slicers (e.g. sampling location)Total sample (only affected by calendar slicer)% difference
16-2420%30%-10%
25-3440%40%0%
35-4440%30%+10%

 

To get the % total for each category which responds to the various slicers I have used the following formula, but this is only half of the equation:

 

% Age Range = DIVIDE(COUNT(Data[Which age group are you in?]),CALCULATE(COUNT(Data[Which age group are you in?]),ALL(Data[Which age group are you in?])))

 

To make matters more complicated, for some of the tables I am using a dimensions table to convert the variable key into a more relevant description. i.e. the raw data holds age range codes from 1-8 which equate to typical age range brackets listed in the dimensions table (16-24, 25-34 etc). Unfortnately the formula above doesn't work in this context.

 

Image.png

 
Question
1: Does anyone know how I could re-write this to prevent any filters from affecting it (except date range) to create a 'whole sample' measure?
2: Is there a way of writing this to allow it to work using the dimension table 
 
I've mocked up a simple version of the data model here so you can see what I am trying to accomplish.
 
Thank you in advance for any help with this!
 
Kind regards
Michael
 
0 REPLIES 0

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.