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].
AllisonKennedy
Community Champion
4 years agoAnonymous See if this works for you:
Distinct Count Complex Measure =
VAR _TableContext = ADDCOLUMNS( Calendar, "Row Context", Calendar[DateTime], "Complex Measure", [Complex Measure])
VAR _TableIndex = SUMMARIZE(_TableContext, [Complex Measure] )
VAR _Result = COUNTROWS( _TableIndex)
RETURN _Result