Forum Discussion
Distinct count + Display the right class
- 5 years ago
Hi, Anonymous
Based on your description, I created data to reproduce your scenario. The pbix file is attached in the end.
Table:
You may create a measure as below.
Re = var tab = SUMMARIZE( 'Table', 'Table'[Test], "Result", IF( [Test]=1, CALCULATE( DISTINCTCOUNT('Table'[ID]), FILTER( ALLEXCEPT('Table','Table'[Test]), NOT([ID] in CALCULATETABLE( DISTINCT('Table'[ID]), FILTER( ALL('Table'), [Test]=2 ) ) ) ) ), DISTINCTCOUNT('Table'[ID]) ) ) return SUMX( tab, [Result] )Result:
Best Regards
Allan
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Distinctcount returns 5 values if I display them in a simple columns graphic. That's okay.
But I wanna display Distinctcounts as per Test, getting four 1's and one 2. The output should be one column counting 4 for "1" and one column counting 1 for "2".
The problem is that I am getting only one column counting 5 for "1". I am getting five 1's, that is to say, PowerBI is "rejecting" the TEST value 2 for ID 5, but I would like to reject TEST value 1 for ID 5.
I hope I made myself more clear.
PS: When I say "column" I am refering to the bar of the bars graphic.