Forum Discussion
DAX IF formula
- Anonymous9 years ago
DHB I'm not aware of how to get around the first requirement, I'd just add the additional "IF". the second one searching for "media" in the value should be resolved using the added syntax I have below:
Column =
IF('assignment_dim'[submission_types] = "discussion_topic","Discussion",
IF(assignment_dim[submission_types]= "online_upload", "Plain Assignment",
IF(assignment_dim[submission_types]= "external_tool", "External Tool",
IF(assignment_dim[submission_types]= "not_graded", "Ungraded",
IF(assignment_dim[submission_types]= "online_quiz", "Quiz",
IF(assignment_dim[submission_types]= "none", "Plain Assignment",
IF((SEARCH("*media*", assignment_dim[submission_types],1,0)>0)= TRUE, "Media Content","Other"
)))))))
I've now built the following formula which works, thanks to your input Eno1978.
Column = IF('assignment_dim'[submission_types] = "discussion_topic","Discussion", IF(assignment_dim[submission_types]= "online_upload", "Plain Assignment", IF(assignment_dim[submission_types]= "external_tool", "External Tool", IF(assignment_dim[submission_types]= "not_graded", "Ungraded", IF(assignment_dim[submission_types]= "online_quiz", "Quiz",IF(assignment_dim[submission_types]= "none", "Plain Assignment","Other"))))))
A couple of questions though;
I've asked for "online_upload" and "none" to both read as "Plain Assignment" in the new column. Is there a way I can write "online_upload" OR "none" in the single IF or do I have to write an IF for each as I have above?
I want "Media Content" in the new column for all vlaues in the first column that contain the word "media". How can I incorporate this?
thanks again.
DHB I'm not aware of how to get around the first requirement, I'd just add the additional "IF". the second one searching for "media" in the value should be resolved using the added syntax I have below:
Column =
IF('assignment_dim'[submission_types] = "discussion_topic","Discussion",
IF(assignment_dim[submission_types]= "online_upload", "Plain Assignment",
IF(assignment_dim[submission_types]= "external_tool", "External Tool",
IF(assignment_dim[submission_types]= "not_graded", "Ungraded",
IF(assignment_dim[submission_types]= "online_quiz", "Quiz",
IF(assignment_dim[submission_types]= "none", "Plain Assignment",
IF((SEARCH("*media*", assignment_dim[submission_types],1,0)>0)= TRUE, "Media Content","Other"
)))))))
- DHB9 years ago
Helper V
That's awesome. It works perfectly, thank you Eno1978.