Forum Discussion

xiumi_hou's avatar
xiumi_hou
Post Partisan
6 years ago
Solved

Need help for dax function

Dear all, the below dax gave me wrong result, can someone helpe me figure it out?   What I really want is: If   'Cases'[Cases_cstm.referred_by_c])="Self"  then report "5" If  'Cases'[Cases_cstm....
  • v-lili6-msft's avatar
    6 years ago

    HI xiumi_hou 

    Your formula works in a measure, if you are want to create a column, please adjust the formula as below:

    Referral_Source_Type =
    IF (
         'Cases'[Cases_cstm.referred_by_c]  = "Self",
        "5",
        IF (
             'Cases'[Cases_cstm.referred_by_c]  = "Practitioner",
            SWITCH (
                TRUE (),
                'prac_practitioners'[type]  = "general_practitioner", "1",
                'prac_practitioners'[type]  = "nurse_practiitoner", "2",
                'prac_practitioners'[type]  = "psychiatrist", "3"
            ),
            " "
        )
    )

     

    Regards,

    Lin