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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Titatovenaar2
Helper III
Helper III

DAX Measure: Show ID's in Table where COUNT(other column) > 1

Hi,

 

I have a simple table like this:

IDCat
1A
2A
3B
4C
5D
6D

 

I want to only view the ID's where Cat is double or more in a table, by using a measure as filter on a table.

The result should look like this:

 

IDCatMsr
1A1
2A1
3B0
4C0
5D1
6D1

 

The following DAX shows the correct COUNT (in total 4 ID's), but when placed on a table, the table is entirely empty. It does not show 1's or 0's per row:

 

COUNTX(
	SUMMARIZE(
		NATURALINNERJOIN( --With this JOIN I get back to the Table[ID] level
--This is important because that's the level I want the 1's and 0's to be working.
		    FILTER( 
--Here I get all the Table[Cat] that have been used multiple times.
		        SUMMARIZE(Table, Table[Cat], "IDs", COUNT(Table[ID]))
		        ,[IDs] > 1
		    )
		    ,SUMMARIZE(Table, Table[Cat], Klant[ID])
		)
		,Table[ID]
	), 1
)

 

When I drag this into the example table, the entire table is BLANK.

If I remove the NATURALJOIN and remove the Table[ID] column, it does show me the 1's and 0's, but this is on the level of Table[Cat], I want this to work at the level of Table[ID].
I need a measure instead of a calculated column in this model.

 

Does anyone have any suggestion how to tackle this?

Kind regards,

Igor

1 ACCEPTED SOLUTION
v-tangjie-msft
Community Support
Community Support

Hi @Titatovenaar2 ,

 

According to your description, here are my steps you can follow as a solution.

(1) My test data is the same as yours.

(2) We can create a measure. 

Measure = 
var _Cat = CALCULATE(COUNT('Table'[Cat]),ALLEXCEPT('Table','Table'[Cat]))
return
IF(_Cat > 1,1,0)

(3) Then the result is as follows.

vtangjiemsft_0-1670380834521.png

Best Regards,

Neeko Tang

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

2 REPLIES 2
v-tangjie-msft
Community Support
Community Support

Hi @Titatovenaar2 ,

 

According to your description, here are my steps you can follow as a solution.

(1) My test data is the same as yours.

(2) We can create a measure. 

Measure = 
var _Cat = CALCULATE(COUNT('Table'[Cat]),ALLEXCEPT('Table','Table'[Cat]))
return
IF(_Cat > 1,1,0)

(3) Then the result is as follows.

vtangjiemsft_0-1670380834521.png

Best Regards,

Neeko Tang

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

Works perfect and fast, thanks!

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!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.