Forum Discussion
SWITCH function to use images in Slicer
Hi hcdecon,
From the screenshot, it seems that you have some mistakes for the switch formula which I highlight in red.
Please modify your formula and try again.
If you still need help, could you please share a dummy pbix file which can reproduce the scenario, so that we can help further investigate on it? You can upload it to OneDrive or Dropbox and post the link here. Do mask sensitive data before uploading.)
Best Regards,
Cherry
- Anonymous8 years agoNot applicable
Adding to v-piga-msft response, a switch statement also needs an 'other' value. Effectively this is what the switch statement needs to do if all of the conditions fail. so rather than remove the Comma as has been suggested, you need an image url to show if none of the above conditions are satisfied..
- hcdecon8 years agoRegular Visitor
Hi Anonymous thanks for the response.
Sorry I'm quite new to this, how do I add the 'other' value to show if none of the above conditions are satisfied? I couldn't find the answer online.
- Anonymous8 years agoNot applicable
Switch Statements are normally written like this:
SWITCH( "Compare to me", "Are you 6?", "This is the answer", "Are you 7?", "That is the answer", "Are you more than 7?", "Answer this way", "Instead answer like this" )
Or sometimes in a format more like this
SWITCH( TRUE, 6 = 'Table'[Field], "This is the answer", 7 = 'Table'[Field], "That is the answer", 'Table'[Field] > 7, "Answer this way", "Instead answer like this" )
Hopefully this illustrates it better for you
- hcdecon8 years agoRegular Visitor
Hi v-piga-msft thanks for the response.
I removed the comma but then the error message "DAX comparison operations do not support comparing values of type Text with values of type Number. Consider using the VALUE or FORMAT function to convert one of the values." came up? The expressions (18-35 etc) are categories of ages.