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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
dataforhumans
Frequent Visitor

Preventing certain rows from being filtered in calculated measure

I have a measure to be calculated that should respond to slicers on the page, but it should never filter out a certain subset of rows denoted by a boolean column.

 

So for the table:

ValueColoris_filterable

1

YellowTRUE
2GreenTRUE
3BlueTRUE
10RedFALSE
10OrangeFALSE

 

the result of sum_measure that sums the Value column but never filters rows where is_filterable = FALSE should look like this:

 

sum_measureColor
21Yellow
22Green
23Blue
20Red
20Orange

 

How can this be achieved?

3 REPLIES 3
v-zhouwen-msft
Community Support
Community Support

Hi all,thanks for the quick reply, I'll add more.

Hi @dataforhumans ,

Regarding your question, you want the line items to be affected by the slicer, but the sum not to be affected by the slicer, correct?

The Table data is shown below:

vzhouwenmsft_0-1722230463879.png

You can use the 'Calculate' function to override the outer filter condition with the inner filter condition.


Measure = CALCULATE(SUM('Table'[Value]),'Table'[is_filterable] = TRUE() || 'Table'[is_filterable] = FALSE())

Final output

vzhouwenmsft_1-1722230623542.png

If I understand you wrongly, please provide more information.

 

Best Regards,
Wenbin Zhou

danextian
Super User
Super User

Hi @dataforhumans ,

 

Creating a measure will  return a  value like as if those rows are not filtered but they will not be visible.  For example, calculating YTD value as of 2023/12/30 - a measure can return the value for that but once you select that date from a slicer only the selected date will be visible.  That's how related colums and tables work. A disconnected table might abe able to achieve this but your post just doesn't have enough information to propose a solution. Please refer to this post on how to get your question answered quickly - https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447... 










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


Proud to be a Super User!









"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.
hnguy71
Super User
Super User

Hi @dataforhumans 

The following removes the filter context from your measure: You can try this:

CALCULATE([sum_measure], ALL(is_filterable))

 



Did I answer your question?
Please help by clicking the thumbs up button and mark my post as a solution!

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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