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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.

Reply
niirusan
Frequent Visitor

Cannot Filter on Calculated Tables with Measures

Hi Guys,
I have been stumped for days trying to figure out how to get the correct result. I am sure I cannot see the wood for the trees and nothing I try seems to work. I am sure there must be a simple answer. Looking for some help.
I have a table (QCInspections) which among other things contains a list of supplier codes, a number of units which passed inspection, and a total number inspected. Something like this... 

Supplier CodePassedInspected
AAAAA2530
BBBBB4950
CCCCC2100

 

I have created 2 measures one to calculate the pass rate : 

 

Units_Pass_Rate = DIVIDE([Passed],[Inspected])

 

And another to sort suppliers into groups based on the pass rate:

 

group_supplier = 
SWITCH(
TRUE,
[Units_Pass_Rate] >=0.95, 1,
[Units_Pass_Rate] >=0.90 && [Units_Pass_Rate] < 0.95, 2,
[Units_Pass_Rate] <0.90, 3,
4)

 

What I am trying to do for a given filter context is count the number of suppliers in group 1 (>=0.95) and put the result into a card. Sounds simple?
This is the measure I have created to do this, however I simply cannot get the filter to work. I get a result, however the result counts all suppliers. It does not count only the suppliers.

 

count_group1_suppliers =
VAR supplier_group = 
ADDCOLUMNS (
VALUES(QCInspections[Supplier_Code]),
"@Group", [GroupSupplier] )

VAR result = 
CALCULATE (COUNTROWS(supplier_group), FILTER (supplier_group, [@Group] = 1))
RETURN result

 

For the life of me, I cannot get this to work. It feels like this should be really simple, but I am messing around with calculated tables and not getting any joy. Does anyone have any ideas.

 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@niirusan , calculated Tables and columns can not use slicer values. so no benefit of filtering them with meausre.

 

A var table inside the measure can get filtered

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@niirusan , calculated Tables and columns can not use slicer values. so no benefit of filtering them with meausre.

 

A var table inside the measure can get filtered

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

HI @amitchandak ,
Thanks for your response. I am not quite sure what you mean. Is 'supplier_group' not a var table?

VAR supplier_group = 
ADDCOLUMNS (
VALUES(QCInspections[Supplier_Code]),
"@Group", [GroupSupplier] )

 If not, then what is?

Apologies if this is a DAX 101 question?

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.