Forum Discussion
AngelaB
2 years agoHelper I
Differentiating between null value and zero in calculated column
Hello **I'm reposting this with the addition of a .pbix and .csv file as the original post (DAX command to differentiate between null value an... - Microsoft Fabric Community) has gone dead** ...
- 2 years ago
Hi,
I am not sure if I understood your question correctly, but please try something like below whether it suits your requirement.
%COG_IMP = VAR _a = CALCULATE ( COUNTA ( 'Interviews_All-Data'[Mind Active] ), 'Interviews_All-Data'[Mind Active] IN { "Yes" } ) VAR _b = COUNTA ( 'Interviews_All-Data'[Mind Active] ) RETURN IF ( _a = 0 && _b <> 0, 0, DIVIDE ( _a, _b, BLANK () ) )
Jihwan_Kim
2 years agoSuper User
Hi,
I am not sure if I understood your question correctly, but please try something like below whether it suits your requirement.
%COG_IMP =
VAR _a =
CALCULATE (
COUNTA ( 'Interviews_All-Data'[Mind Active] ),
'Interviews_All-Data'[Mind Active] IN { "Yes" }
)
VAR _b =
COUNTA ( 'Interviews_All-Data'[Mind Active] )
RETURN
IF ( _a = 0 && _b <> 0, 0, DIVIDE ( _a, _b, BLANK () ) )
- AngelaB2 years agoHelper I
Yes, this worked! Thank you, I knew there had to be simple solution but just couldn't get there. Thanks so much for your help.