I have a simple table here:
I need to make a measure that counts records grouped by the Number column.
Ideally:
I also need this measure to by dynamic for whatever records are selected. So if a subset of the table is being used:
(Same example table, but with 2 less records)
Then the ideal output would be:
Now output for number '1' is 2 instead of 4.
Some of the code I tried:
,"CNT",COUNTROWS(ALLSELECTED([Table1]))
,"Summz",SUMMARIZE(ALLSELECTED(Table1),"CNT",COUNTROWS(Table1))
,"CALC",CALCULATE(COUNT(Table1[Rownum]),ALLEXCEPT(Table1,Table1[Number]))
,"CALCII",CALCULATE(
SUMX(
ADDCOLUMNS(
SUMMARIZE(Table1,Table1[Rownum])
,"Freq",DISTINCTCOUNT(Table1[Number])
),
[Freq])
,REMOVEFILTERS(Table1[Rownum])
)
I feel like I'm close but not getting it. Any help would be appreciated!
Thank you
Try this.
Freq = CALCULATE( COUNT(Table1[Number]), ALLEXCEPT(Table1,Table1[Number]))