Forum Discussion
bhatsuchi
8 years agoFrequent Visitor
DAX to count rows with same value for Column A for a value in column B
Id Email
1 [email protected]
2 [email protected]
3 [email protected]
1 [email protected]
1 [email protected]
2 [email protected]
2 [email protected]
3 [email protected] Hello! I have a table with data like above. I want to create...
- 8 years ago
You may refer to the measures below.
Measure = COUNTROWS ( FILTER ( VALUES ( Table1[Id] ), CALCULATE ( COUNT ( Table1[Email] ) > DISTINCTCOUNT ( Table1[Email] ) ) ) )Measure 2 = COUNTROWS ( FILTER ( VALUES ( Table1[Id] ), CALCULATE ( DISTINCTCOUNT ( Table1[Email] ) > 1 ) ) )
Anonymous
7 years agoNot applicable
Mariusz Great! I think one thing missing is. I am not seeing anything that is
0 Times repeated =
Is our dynamic table showing data like
ID_001 as = 1 time repeated?
and
ID_001
ID_001
as = 2 times repeated?
After we got this. I would like to know if we can group repeated tiems like this example:
0 times repeated | 50 ids 1-3 times repeated | 20 ids 4-5 times repeated | 10 ids >5 times repated | 8 ids
Mariusz Thank you so much for your help on this.
Mariusz
Community Champion
7 years agoHi Anonymous
Please see the adjusted code.
Table =
SELECTCOLUMNS(
ADDCOLUMNS(
DISTINCT( DirectQuery[ID_ColumnID_001] ),
"no", CALCULATE( COUNTROWS( DirectQuery ) ) -1
),
"ID_ColumnID_001", [ID_ColumnID_001],
"Repeated time no", [no],
"Repeated time",
SWITCH(
TRUE(),
[no] = 0, "0",
[no] IN{ 1, 2, 3 }, "1-3",
[no] IN{ 4, 5 }, "4-5",
"> 5"
) & " times reported"
)