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
SimonJacobs
Helper I
Helper I

Calculating Averages when using a Calculate and Filter Measure

Hi,

 

I'm having trouble working with multiple measures that have diffierent filters.  I'm trying to build a dynamic dashboard that allows users to select views of data so the filters are controlled by slicers rather than being specified in the measure.  The problem is I want to create an index that divides one measure for the selected view against the average for that metric across all data for that country.

 

To give an example of my data:

 

CountryBrandData TypeMetricValue
UKBrand 1Brand AwarenessAware25%
UKBrand 2Brand AwarenessAware17%
UKBrand 3Brand AwarenessAware54%
UKBrand 4Brand AwarenessAware35%
UKBrand 1Brand AwarenessFamiliar20%
UKBrand 2Brand AwarenessFamiliar12%
UKBrand 3Brand AwarenessFamiliar49%
UKBrand 4Brand AwarenessFamiliar30%
USBrand 1Brand AwarenessAware15%
USBrand 2Brand AwarenessAware5%
etc…    

 

So for example I want to calculate awareness for Brand 1 vs. the average brand awareness across all brands in the UK.  I have a measure Percent Sum (sum(BrandTrackerData[Value])) and Percent Average (average(BrandTrackerData[Value]).  I then have a page of charts controlled by slicers to select the country, the brand and the metric.  When I chart Percent Sum and Percent Average independently they work - I have the slicer that selects the brand controlling the percent sum chart but not the percent average chart so it calculates against all brands.  However when I try to create a 3rd measure - Index = [Percent Sum] / [Percent Average] I can't see a way to filter percent sum on the selected brand but calculate percent average against all brands.

 

Any help would be much appreciated!

 

 

Simon

8 REPLIES 8
mfc1982
Frequent Visitor

I have a similar problem, did you get an answer on this?

Not yet.

Hi Simon,

 

I just tested with your data example and create the measures with the formula below:

Percent Sum := sum(BrandTrackerData[Value])

Percent Average := average(BrandTrackerData[Value])

Index := [Percent Sum] / [Percent Average]

 

Create a table, and some Slicer visuals in the Report View, the filter works as below.

So could you please share some screenshot regarding what you would like to achieve here?

9.PNG10.PNG

Regards

 

Hi Michael,

 

Thank you for your reply.  The measures you've included look the same as what I have so I've pasted some screenshots below to clarify the issue I'm having.

 

The Percent Sum and Percent Average measures calculate OK because the Percent Sum is filtered based on all 4 slicers (so only based on Brand 2 below) whereas the Percent Average is not filtered on the Brand slicer and therefore calculated across Brands 1 to 3.  The issue is the Index measure - it comes out as 1 for all age groups.  I suspect this is because the chart has to either be controlled or not controlled by the brand slicer meaning that both measures are either on just the selected brand, or on all brands and thus both measures give the same number and an index of 1... Does that make sense?

 

In the example below what I want to see for the 16-24 index value is 0.17 (1/6)

 

Brand Tracker Screenshot.jpg

 

Thanks,

 

Simon

Hi simon,

Thanks for the posts, and apology for the late response.

Would you please share the Axis value here?

In addition, replace the index formula with the following:

Index := sum(BrandTrackerData[Value]) / average(BrandTrackerData[Value])

Verify if issue insists.

Regards

Thanks for the response Michael.  I tried changing the Index formula and the issue was still the same.  I'm not sure what you mean by the axis value.  Does this help?:

 

Axis.jpg

Hi SimonJacobs,

 

My bad.

I mean the 16-24, 25-34, if possible, would you please share about how "Cut" is calculated?

Regrads

 

No worries.  The cuts aren't calculated the data is already aggregated into the age bands.  I've pasted a sample of the data below.BIDataStructure.jpg

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.