Forum Discussion
Anonymous
4 years agoNot applicable
Distinct count on measure within table context
Hi all, Frustration is at an all-time high today.. I have a very complex model in my PowerBI. Lots of tables and measures. In the end, I have created this table using a complex measure: ...
- Anonymous2 years ago
Okay, I somehow managed to create a working measure.
It looks like this:CALCULATE( COUNTROWS(SUMMARIZE(Calender, Calender[Date])) + 0, FILTER(Calender, [Number of objects available & unavailable with valid reason] - [Minimal number of objects] < 0) )
I completely skipped the part where I create a measure that contains the word 'FLAG' and then performing a (distinct) count on that measure. I think the problem was that in my 'FLAG'-measure, I used:MIN(Calender[DateTime])
.. which is why it only worked when I included the [DateTime].
bcdobbs
4 years agoCommunity Champion
I agree with AllisonKennedy the code provided should be doing what you need.
You could try this similar pattern:
https://www.sqlbi.com/blog/marco/2018/05/31/how-to-write-distinctcountx-in-dax/