Forum Discussion
Concatenating results from an IF statement
- Anonymous8 years ago
Hi twolten,
Nope. dax not support calculation which you mentioned, you had to manually write formula/variable to calculate and return merged result .
Calculate column formula:
formula = VAR v1 = IF ( Table[Col1] + Table[Col2] > 0, "Ans1" ) VAR v2 = IF ( Table[Col3] + Table[Col4] > 0, "Ans2" ) VAR v3 = IF ( Table[Col5] + Table[Col6] > 0, "Ans3" ) VAR v4 = IF ( Table[Col1] + Table[Col2] + Table[Col3] + Table[Col4] + Table[Col5] + Table[Col6] = 0, "Ans4" ) RETURN IF ( v4 <> BLANK (), v4, v1 & v2 & v3 )Regards,
Xiaoxin Sheng
Hi twolten,
Nope. dax not support calculation which you mentioned, you had to manually write formula/variable to calculate and return merged result .
Calculate column formula:
formula =
VAR v1 =
IF ( Table[Col1] + Table[Col2] > 0, "Ans1" )
VAR v2 =
IF ( Table[Col3] + Table[Col4] > 0, "Ans2" )
VAR v3 =
IF ( Table[Col5] + Table[Col6] > 0, "Ans3" )
VAR v4 =
IF (
Table[Col1] + Table[Col2] + Table[Col3] + Table[Col4] + Table[Col5] + Table[Col6] = 0,
"Ans4"
)
RETURN
IF ( v4 <> BLANK (), v4, v1 & v2 & v3 )
Regards,
Xiaoxin Sheng
- twolten8 years agoFrequent Visitor
Thank you for this, it is really helpful!
However, I have run into another problem now. With the DAX calaculation complete I realised there is no way to parse the results of the calculation for filtering purposes.
For instance on result will have 'Ans1,Ans4' and another will have 'Ans1,Ans2,Ans3'
How can I parse these to be able to filter the results? Any ideas?
Thank you again for the help so far.