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
Steven2020
New Member

Calculate average based on multiselect filter within report

I have a dataset like:

ReportDateValue
ADec 1 2019

1

ADec 3 20191
AJan 1 20201
BDec 1 20191
BJan 1 20201
BJan 2 20201
 

I need to calculate the average value for a report, where the months that are included are filtered based on a multiselect dropdown filter on the PowerBi report page. The dropdown would include Decebmer and January as the two options in this scenario.

The results I'm expecting if just December are selected is:

ReportAverage
A3
B1
 

And if both December and January are selected is:

ReportAverage
A2.5
B1.5

 

I've already created an expression to capture the months selected in the dropdown filter with:

CountMonths = COUNTROWS(FILTERS('Dataset'[Date]))

 

but it doesn't seem to be using "2" in the denomiator of:

 

AverageViewCount = Dataset[value]/Dataset[CountMonths]

 

The expression seems to just be summing the Value column when I display everything in a table.

 

Thanks!

2 REPLIES 2
az38
Community Champion
Community Champion

Hi @Steven2020 

How did you get Average=3 for selected December and Report A if you have only 2 rows in dataset?

do not hesitate to give a kudo to useful posts and mark solutions as solution


do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

Whoops, I'm not sure how I managed to mess all those assumptions up lol. The correct assumptions should be:

December only:

Report | Average

A         | 2 (2 rows over 1 month)

B         | 1 (1 row over 1 month)

 

December + January

Report | Average

A         | 1.5 (3 rows over 2 months)

B         | 1.5 (3 rows over 2 months)

 

Hope this clears things up!

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