Forum Discussion
conditional count
Hi Anonymous ,
I create a simple sample. Please try and check if it is what you want.
Measure =
VAR _count =
CALCULATE (
COUNTROWS ( 'Table' ),
FILTER (
ALLEXCEPT ( 'Table', 'Table'[Subject] ),
'Table'[Activity type code] = "Workshop"
)
)
RETURN
IF ( _count <= 2, _count, 1 )
For more details, please see the attachment.
Best Regards,
Xue Ding
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
i tried the exact formula, but i got this error message:
- v-xuding-msft6 years agoCommunity Support
Hi Anonymous ,
Can you please share the error message again? The photo is missing. And if you could share a dummy pbix file, we will understand the actual situation clearly and solve it quickly.
Best Regards,
Xue Ding
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- Anonymous6 years agoNot applicable
- amitchandak6 years agoSuper User
Looking at the data screenshot, you posted earlier. Looking at yellow and orange, I can not make a logic when to count and when to distinctcount. But assume you have such condition that can give difference
then try a new measure
measure = var _cnt = calculate(count(table[subject]),table[subject] = "???") var _discnt = calculate(distinctcount(table[subject]),table[subject] <> "???") return _cnt + _discnt