Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
Noadekat
New Member

Make a measure with filter

Hello,

 

I would like to make a visual to compare all data with the data of an selected filter. I thougt I would do this with a measure. This is my measure for all data: 

 

Average mistakes total = DIVIDE(SUM('Technical Research'[Number of Mistakes]), [Number of subjects])
 
But now I want to add a filter into the measure, I want the average of the mistakes from only one subject. I tried something like this:
 
Average mistakes subject 1DIVIDE(SUM('Technical Research'[Numer of Mistakes]), [Number of subjects])
(FILTER('Data of Subjects', [Subject] = "1"))
 
I hope you'll understand what I mean! Thank you in forward.
 
 
1 ACCEPTED SOLUTION

Then you need to create a 2nd measure. Keep your original measure for filtering per Subject.

Use this for the whole Average

Average All =
VAR _AllMistakes = CALCULATE(SUM('Technical Research'[Number of Mistakes]), ALL ('Technical Research'))
VAR _AllSubjects = CALCULATE(COUNT('Technical Research'[Subjects]), ALL ('Technical Research'))

RETURN
DIVIDE(_AllMistakes, _AllSubjects, 0)

 

Change Count to Distinctcount if you are looking for unique number for teh subjects.

 

Add both measures to the Visual

 

Joe

 

 




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Learn about the Star Schema, it will solve many issues in Power BI!

Date tables help! Learn more



LinkedIn
Let's connect on LinkedIn


View solution in original post

3 REPLIES 3
Joe_Barry
Super User
Super User

Hi @Noadekat 

 

Your measure looks good, but have you tried adding a slicer with the subjects on the page? When you choose a subject, the measure will automatically filter to the Average of that Subject. Also in a Table visual, you can add the subjects and your measure and it will also filter to the Average.

 

Is that what you need? Maybe provide a clearer example?

 

Thanks

Joe




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Learn about the Star Schema, it will solve many issues in Power BI!

Date tables help! Learn more



LinkedIn
Let's connect on LinkedIn


Hi! 

 

Thankyou for your answer. The problem is that I want both averages in one visual, so the average of all subjects ánd the average of only one subject. In that way you can compare them to eachother. If I make a slicer, the slicer will effect both lines.

 

Noadekat_0-1717589815386.png

 

Then you need to create a 2nd measure. Keep your original measure for filtering per Subject.

Use this for the whole Average

Average All =
VAR _AllMistakes = CALCULATE(SUM('Technical Research'[Number of Mistakes]), ALL ('Technical Research'))
VAR _AllSubjects = CALCULATE(COUNT('Technical Research'[Subjects]), ALL ('Technical Research'))

RETURN
DIVIDE(_AllMistakes, _AllSubjects, 0)

 

Change Count to Distinctcount if you are looking for unique number for teh subjects.

 

Add both measures to the Visual

 

Joe

 

 




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Learn about the Star Schema, it will solve many issues in Power BI!

Date tables help! Learn more



LinkedIn
Let's connect on LinkedIn


Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.