Forum Discussion
Dax - distinctcount as SQL query (no exists)
Hi @souzacaleb,
Here’s my sample data:
Please check following steps as below:
1. Create calculated columns:
Column =
var a = CALCULATE(COUNTROWS('table'),FILTER('table','table'[Name] = EARLIER('table'[Name])))
var b = CALCULATE(COUNTROWS('table'),FILTER('table','table'[Name] = EARLIER('table'[Name])&&'table'[Flag] = 1))
return
a=b
2. Create measure:
Measure = CALCULATE(DISTINCTCOUNT('table'[Name]),FILTER('table','table'[Column] = TRUE()))
3. Result would be shown as below:
Best Regards,
Jay
Community Support Team _ Jay Wang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi Anonymous
Is there any way achieve the same result without create the columns step? Is it possible to do all in a measure?
I aprecciate for you help.
- Anonymous6 years agoNot applicableHi Anonymous ,The following measure might be helpful for you:Measure 2 = CALCULATE(DISTINCTCOUNT('table'[Name]),FILTER('table',MIN('table'[Flag])>0))And the result would be shown as below:Best Regards,Jay