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

The Power BI Data Visualization World Championships is back! It's time to submit your entry. Live now!

Reply
Anonymous
Not applicable

Using filter to compare two columns and count Rows from a category

Hi Everyone, Beginer here in Dax .

 

I have a Table as below .

 

IDPolicy NumberPolicy SequenceMaster Sequence
1234562121W13
12345621344523
123456415333
21345XVw1C12
21345XVCE22

 

My Table looks like Above , I would need to pick rows in this way after the filtering

and do the count of those rows that are filtered.

 

IDeal table

 

 

IDPolicy NumberPolicy SequenceMaster Sequence
123456415333
21345XVCE22

 

I can't seem to figur out exactly what need to be done in the filter.

 

My query is as below.

" CALCULATE(",

" DISTINCTCOUNT('Policy'[Policy Master Number]),",

" 'Policy' [Master Sequence] = 'Policy' [Policy Sequence]",

 

I know this should work in Sql and give a single row but i get this error when i try to do it this way to filter sigle row .

 

The expression contains multiple columns, but only a single column can be used in a True/False expression that is used as a table filter expression."

 

Any Help here would be greatly appreciated .

 

 

 

 

 

 

 

 

 

 

1 ACCEPTED SOLUTION
dax
Community Support
Community Support

Hi @Anonymous ,

You could try to add a filter in measure like below to see whether it work or not

 

 

Measure 2 = CALCULATE(MIN('Table (3)'[Master Sequence]), FILTER('Table (3)','Table (3)'[Policy Sequence]='Table (3)'[Master Sequence] && 'Table (3)'[Policy Number]=MIN('Table (3)'[Policy Number])))
Measure = CALCULATE(MIN('Table (3)'[Policy Sequence]), FILTER('Table (3)','Table (3)'[Policy Sequence]='Table (3)'[Master Sequence] && 'Table (3)'[Policy Number]=MIN('Table (3)'[Policy Number])))

 

 

 

Best Regards,
Zoe Zhi

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
dax
Community Support
Community Support

Hi @Anonymous ,

You could try to add a filter in measure like below to see whether it work or not

 

 

Measure 2 = CALCULATE(MIN('Table (3)'[Master Sequence]), FILTER('Table (3)','Table (3)'[Policy Sequence]='Table (3)'[Master Sequence] && 'Table (3)'[Policy Number]=MIN('Table (3)'[Policy Number])))
Measure = CALCULATE(MIN('Table (3)'[Policy Sequence]), FILTER('Table (3)','Table (3)'[Policy Sequence]='Table (3)'[Master Sequence] && 'Table (3)'[Policy Number]=MIN('Table (3)'[Policy Number])))

 

 

 

Best Regards,
Zoe Zhi

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Greg_Deckler
Community Champion
Community Champion

Perhaps create a new column like:

 

Column = IF([Policy Sequence] = [Master Sequence],1,0)

 

Then just filter on Column = 1



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

@Greg_Deckler 

 

Thanks for the Quick Response , Is it possible to create a column from the set on the run time and filter the rows.

 

The reason i'm asking this, we are using this as an cube XMLA rather than a Power Bi Front End.

 

I would have to write a measure .

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! It's time to submit your entry.

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.