Forum Discussion
xiumi_hou
6 years agoPost Partisan
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....
- 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
v-lili6-msft
6 years agoCommunity Support
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