Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and a 50 percent discount on exams.
Get startedEarn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
Hello.
I am trying to use the SWITCH function to replace text for images in a Slicer but for some reason it's not working. The image URLs are fine, I think it may be because the table has active relationships with other tables but not sure how to combat this.
I can't use a Chiclet slicer because this does not sync across the whole report.
Any help would be appreciated, thanks!
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
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.
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..
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.
Hi @hcdecon,
Have you solved your problem?
If you have solved, please always accept the replies making sense as solution to your question so that people who may have the same question can get the solution directly.
If you still need help, please feel free to ask.
Best Regagrds,
Cherry
Hi Cherry,
That problem is solved - I just created a seperate column for ID and used that instead. However, the actual image won't show up on the filter, just the image URL. I have tried several URLS with the same result. Here is a link to a dummy version of the file: https://app.box.com/s/eouqtyk37ipoainxg6xoyms2q9ybff15
Thanks, any help would be appreciated.
Hi @hcdecon,
Please change the Date category of the image url measure to be image URL.
In addtion, images work for URL that over web not local path in Power BI Desktop.
Best Regards,
Cherry
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
User | Count |
---|---|
91 | |
73 | |
68 | |
63 | |
55 |
User | Count |
---|---|
99 | |
88 | |
73 | |
60 | |
58 |