Forum Discussion
Anonymous
6 years agoNot applicable
Multi conditional switch statement
Hello - I have a situaiton where I have a Switch statment that only partially works. I am curious if there is a better way to write this (that actually works!) or perhaps use VAR. My use...
- 6 years ago
One more ) right before your RETURN statement
Multiple or Single = VAR __Table = DISTINCT( SELECTCOLUMNS( FILTER( ALL('Table'), [RMA] = EARLIER([RMA]) ), "__Problem Code",[Problem Code] ) ) RETURN IF(COUNTROWS(__Table) > 1,"Multiple","Single")
Greg_Deckler
6 years agoCommunity Champion
So, no sample text data provided and I don't like typing so going to wing this DAX calculation, apologies in advance for syntax errors. This is for a column.
Multiple or Single =
VAR __Table =
DISTINCT(
SELECTCOLUMNS(
FILTER(
ALL('Table'),
[RMA] = EARLIER([RMA])
),
"__Problem Code",[Problem Code]
)
RETURN
IF(COUNTROWS(__Table) > 1,"Multiple","Single")
- Anonymous6 years agoNot applicable
Thanks Greg. I do get two errors. When I hover over the __Table it says "Parameter is not the correct type. Cannot find name __Table.
And it says the syntax for Return is incorrect.
Any idea why this is happening?
- Greg_Deckler6 years agoCommunity Champion
In your VAR statement, replace the comma at the end with a )
I believe that should fix it.
- Anonymous6 years agoNot applicable
Thanks Greg - Sorry to trouble you but I still got an error. The red lines are saying 1) a syntax error with Return, and 2) the other two red lines say these are "Unexpected Expressions".
So close....!