Forum Discussion
wemsomba10
1 year agoFrequent Visitor
Hello
I m using the switch function but the totals are coming out blank or just not doing any calculations. please help. Selected In Report Switch = var Myselection = SELECTEDVALUE('Change Type'[Type...
Anonymous
1 year agoNot applicable
Hi wemsomba10 ,
I create a table as your DAX codes mentioned.
I think the reason for not displaying the results is the string of DAX code 'var Myselection = SELECTEDVALUE('Change Type'[Type])'. If when I use other functions I am able to display the results.
Selected In Report Switch =
VAR _Myselection =
MAX('Change Type'[Type] )
VAR _SelectNeg =
IF ( [Selected In Report] < [Compared In Report], "Yes", "No" )
VAR _SelectPos =
IF ( [Selected In Report] > [Compared In Report], "Yes", "No" )
VAR _SelectNo =
IF ( [Selected In Report] = [Compared In Report], "Yes", "No" )
VAR _SelectNew =
IF ( AND ( [Selected In Report] > 0, [Compared In Report] = 0 ), "Yes", "No" )
VAR _SelectAll =
IF ( [Selected In Report] >= 0, "Yes", "NO" )
RETURN
SWITCH (
TRUE (),
_Myselection = "Negative Change"
&& _selectNeg = "Yes", [Selected In Report],
_Myselection = "Positive Change"
&& _selectpos = "Yes", [Selected In Report],
_Myselection = "No Change"
&& _SelectNo = "Yes", [Selected In Report],
_Myselection = "New Accnt Added"
&& _SelectNew = "Yes", [Selected In Report],
_Myselection = "All"
&& _SelectAll = "Yes", [Selected In Report]
)
Best Regards
Yilong Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.