Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hi,
I have a pretty simple question. Below is a custom column I'm trying to create with M Code in Power Query Editor (Transform Data). However, I'm getting an error when I try to use the AND function.
Is there another way to use the AND function with M Code? Below is my M Code with the error. How can I incorportate the and functionality below to resolve the issue? I highlighted the error in red below:
Custom Column =
if [Non_Emergent] + [Emergent_PC_Treatable] >.5 and [Non_Emergent] >= [Emergent_PC_Treatable] then “Non-Emergent”
else if [Non_Emergent] + [Emergent_PC_Treatable] >.5 and [Non_Emergent] < [Emergent_PC_Treatable] then “Non-Emergent-PC Treatable”
else if [ER_Needed_Not_Preventable] + [ER_Needed_Preventable_Avoidable] >.5 then “Emergent”
else if [Injury] =1 then “Injury”
else if [Alcohol] =1 then “Mental Health”
else if [Drug] =1 then “Mental Health”
else if [Psych] =1 then “Mental Health”
else ”Unclassified”
Solved! Go to Solution.
@AW1976NOVA , and is and in power query,
Try like
if ([Non_Emergent] + [Emergent_PC_Treatable]) >.5 and [Non_Emergent] >= [Emergent_PC_Treatable] then "Non-Emergent"
else if ([Non_Emergent] + [Emergent_PC_Treatable]) >.5 and [Non_Emergent] < [Emergent_PC_Treatable] then "Non-Emergent-PC Treatable"
else if [ER_Needed_Not_Preventable] + [ER_Needed_Preventable_Avoidable] >.5 then "Emergent"
else if [Injury] =1 then "Injury"
else if [Alcohol] =1 then "Mental Health"
else if [Drug] =1 then "Mental Health"
else if [Psych] =1 then "Mental Health"
else "Unclassified"
@AW1976NOVA , and is and in power query,
Try like
if ([Non_Emergent] + [Emergent_PC_Treatable]) >.5 and [Non_Emergent] >= [Emergent_PC_Treatable] then "Non-Emergent"
else if ([Non_Emergent] + [Emergent_PC_Treatable]) >.5 and [Non_Emergent] < [Emergent_PC_Treatable] then "Non-Emergent-PC Treatable"
else if [ER_Needed_Not_Preventable] + [ER_Needed_Preventable_Avoidable] >.5 then "Emergent"
else if [Injury] =1 then "Injury"
else if [Alcohol] =1 then "Mental Health"
else if [Drug] =1 then "Mental Health"
else if [Psych] =1 then "Mental Health"
else "Unclassified"
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
108 | |
105 | |
88 | |
74 | |
66 |
User | Count |
---|---|
126 | |
111 | |
100 | |
83 | |
71 |