Forum Discussion
Measure with OR conditions and multiple values
Hi Community,
In the following dataset, I created a measure that counts distinct clients where contact type <> "EM" || val1 <> 'Y'|| val2<>"Y".
But the measure reutns 9 clients, I expect 6 (higlighted in yellow).
My PBI file: https://1drv.ms/u/s!Ag919_pO_UKrgThqrNGx2Dwbp9Q6?e=YjOLvi
Any help is appreciated. Thanks
- Anonymous4 years ago
Hi Anonymous ,
Check the formulas.
flag1 = IF(SELECTEDVALUE('Table'[Contact Type])<>"EM"||SELECTEDVALUE('Table'[Val1])<>"Y"||SELECTEDVALUE('Table'[Val2])<>"Y",1,0) flag2 = MINX(FILTER(ALLSELECTED('Table'),'Table'[Client]=SELECTEDVALUE('Table'[Client])),[flag1]) Measure = CALCULATE(DISTINCTCOUNT('Table'[Client]),FILTER(ALLSELECTED('Table'),[flag2]=1))Best Regards,
Jay
7 Replies
- amitchandak
Super User
Anonymous , Why the second A is counted while None of the E is counted ?
- AnonymousNot applicable
amitchandak sorry that's a mistake. A shouldn't be counted. So we expect 6 clients as a result
- amitchandak
Super User
Anonymous , I doubt the logic && and OR
Measure =
CALCULATE (
DISTINCTCOUNT ('Table'[Client] ),
'Table'[Contact Type] <> "EM"
&&( 'Table'[Val1] = "N"
|| 'Table'[Val2] = "N")
)And it might be 5 clients
- AnonymousNot applicable
Hi Anonymous ,
Check the formulas.
flag1 = IF(SELECTEDVALUE('Table'[Contact Type])<>"EM"||SELECTEDVALUE('Table'[Val1])<>"Y"||SELECTEDVALUE('Table'[Val2])<>"Y",1,0) flag2 = MINX(FILTER(ALLSELECTED('Table'),'Table'[Client]=SELECTEDVALUE('Table'[Client])),[flag1]) Measure = CALCULATE(DISTINCTCOUNT('Table'[Client]),FILTER(ALLSELECTED('Table'),[flag2]=1))Best Regards,
Jay