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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
danisharoon1
New Member

Measure - Calculate average while excluding the rows corresponding to the slicer selection

Hi there

 

I have a slicer for category, and a card on which I want to display the average rating. However while calculating the average rating I want to exclude rows corresponding to the category selected via the slicer. All other slicers should apply on the measure.


I found a solution that seems to work fine when I create it in the form of a table with filter interaction disabled. However when I put it in a card with the slicer enabled, the numbers are not matching up in the table and card when I try across category slicer selections.

 

Powerbi file is as follows: exhibit file 

1 ACCEPTED SOLUTION

Hi danisharoon1,

 

It does match up for me, but I realized I must have unfiltered the date slicer.

Wilson__0-1715777457602.png

 

In any case, I think your problem is trying to work with one table and slicing by multiple columns in the same table. This article from SQLBI explains the issue very well. Your solution is to create dimension tables to use in your slicers if you want to leave both slicers up.

 

Dates are strongly advised to be a dimension table in most data models anyway. Let me know if you have follow up questions.


----------------------------------
If this post helps, please consider accepting it as the solution to help other members find it quickly. Also, don't forget to hit that thumbs up and subscribe! (Oh, uh, wrong platform?)

 

P.S. Need a more in-depth consultation for your Power BI data modeling or DAX issues? Feel free to hire me on Upwork or DM me directly on here! I would love to clear up your Power BI headaches.

 

View solution in original post

3 REPLIES 3
Wilson_
Memorable Member
Memorable Member

Hi danisharoon1,

 

I'm confused. I downloaded your pbix and the value in your WithoutSelectedCat card match the table when I change the value of the category slicer. Your measure is also very similar to the way I would've written it.

 

What are you expecting differently?

Hi Wilson

 

If you select Design in the category slicer, you may notice that the number of the measure in card and table is not matching up.

 

danisharoon1_0-1715770193150.png

 

Thank you

Hi danisharoon1,

 

It does match up for me, but I realized I must have unfiltered the date slicer.

Wilson__0-1715777457602.png

 

In any case, I think your problem is trying to work with one table and slicing by multiple columns in the same table. This article from SQLBI explains the issue very well. Your solution is to create dimension tables to use in your slicers if you want to leave both slicers up.

 

Dates are strongly advised to be a dimension table in most data models anyway. Let me know if you have follow up questions.


----------------------------------
If this post helps, please consider accepting it as the solution to help other members find it quickly. Also, don't forget to hit that thumbs up and subscribe! (Oh, uh, wrong platform?)

 

P.S. Need a more in-depth consultation for your Power BI data modeling or DAX issues? Feel free to hire me on Upwork or DM me directly on here! I would love to clear up your Power BI headaches.

 

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.