Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.
Hello guys,
I need some ideas/help with a unique value prob.
I have a table like below. I have two categories, ID coluumn plus a Date column. Each ID is supposed to have one [Category 1] and one [Category 2] but some of the ID's appear twice or thrice in the data. How can I calculate number of values which appear more than once. I cannot get an idea how to show a summary of the data according to category 1 and category 2. Any help is appreciated.
ID | DATE | Category 1 | Category 2 |
1212 | 02/11/22 | ABS | 0 |
1212 | 02/11/22 | IGN | 1 |
1456 | 02/11/22 | ABS | 0 |
1233 | 02/11/22 | XLT | 2 |
1456 | 02/11/22 | IGN | 1 |
1212 | 02/11/22 | ABS | 1 |
1233 | 02/11/22 | XLT | 0 |
4586 | 02/11/22 | ABS | 0 |
4586 | 02/11/22 | IGN | 1 |
1212 | 02/11/22 | IGN | 2 |
4586 | 02/11/22 | XLT | 2 |
1233 | 02/11/22 | XLT | 0 |
1212 | 02/11/22 | ABS | 1 |
1212 | 02/11/22 | IGN | 2 |
Solved! Go to Solution.
Hi @pandeyml ,
Please follow these steps:
(1) Create a new measure
COUNTROW =
COUNTROWS (
FILTER (
ALL ( 'Table' ),
'Table'[ID] = MAX ( 'Table'[ID] )
&& 'Table'[Category 1] = MAX ( 'Table'[Category 1] )
&& 'Table'[Category 2] = MAX ( 'Table'[Category 2] )
)
)
(2)Final output
Best Regards,
Gallen Luo
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @pandeyml ,
Please follow these steps:
(1) Create a new measure
COUNTROW =
COUNTROWS (
FILTER (
ALL ( 'Table' ),
'Table'[ID] = MAX ( 'Table'[ID] )
&& 'Table'[Category 1] = MAX ( 'Table'[Category 1] )
&& 'Table'[Category 2] = MAX ( 'Table'[Category 2] )
)
)
(2)Final output
Best Regards,
Gallen Luo
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
[# IDs > 1] = // measure
// This measure returns the number of distinct
// ID's that are visible in the current context
// and which are duplicated in the whole set.
var AllDoubledIds =
CALCULATETABLE(
FILTER(
DISTINCT( T[ID] ),
// Will select only those ID's that
// have at least 2 rows in the whole
// table.
CALCULATE( COUNTROWS( T ) > 1 )
),
// Remove all the filters from the table.
REMOVEFILTERS( )
)
var CountOfsDoubledIds =
COUNTROWS(
// Will return those ID's visible
// in the current context that are
// duplicated in the whole dat set.
INTERSECT(
DISTINCT( T[ID] ),
AllDoubledIds
)
)
RETURN
CountOfDoubledIds