Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Using ifelse and list in DAX

I would like to change the sign of _myMeasure when 'dimData'[Column] in var_ list. What I am missing in the code below ? many thanks in advance.

_MySign = 
var _ list = {"AAA", "BBB", "CCC"}
IF(
'dimData'[Column] in _ list,
[_MyMeasure]*-1, 
         [_MyMeasure] 

)

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

You don’t need to declare _list variable again inside the IF statement.

Assuming this code is for a measure then you need to wrap ‘dimData'[Column] with SELECTEDVALUE.

_MySign =
VAR _list = { "AAA", "BBB", "CCC" }
RETURN
    IF (
        SELECTEDVALUE ( 'dimData'[Column] ) IN _list,
        [_MyMeasure] * -1,
        [_MyMeasure]
    )
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading