Forum Discussion
Workaround a for Measure to return a URL
I am trying to construct a table in my dashboard with some numerical data for various categories, with an image indicating whether the category is above or below a certain benchmark. I am using the provided Table visualization.
For example, where the Max benchmark is 90:
Category Num of Days Benchmark
Red 72 Yes
Blue 102 No
Green 53 Yes
But instead of Yes and No, I would like to show an image (like a thumbs up for Yes, and thumbs down for No).
I am currently trying to use a Measure to do this, but measures do not allow you to set the data type as Image Url, so the value just returns as text.
Columns allow the option to have the data as a URL. However when I use a column to do this, and add it to my visualization, it doesn't just average the data by category, but also by the benchmark. So the above example table instead becomes something like this:
Category Num of Days Benchmark
Red 43 Yes
Red 108 No
Blue 64 Yes
Blue 178 No
Green 15 Yes
Green 91 No
How can I fix this issue? Is there some workaround to let a Measure return an Image Url?
Or can I add a column to a visualization without that column becoming a filter?
Thank you!
You may use DAX below to add a calculated column.
Benchmark = VAR AvgOfDays = AVERAGEX ( FILTER ( Table1, Table1[Category] = EARLIER ( Table1[Category] ) ), Table1[Num of Days] ) RETURN SWITCH ( TRUE (), AvgOfDays <= 90, "https://www.google.com/favicon.ico", "https://www.microsoft.com/favicon.ico" )
5 Replies
- v-chuncz-msftCommunity Support
You may use DAX below to add a calculated column.
Benchmark = VAR AvgOfDays = AVERAGEX ( FILTER ( Table1, Table1[Category] = EARLIER ( Table1[Category] ) ), Table1[Num of Days] ) RETURN SWITCH ( TRUE (), AvgOfDays <= 90, "https://www.google.com/favicon.ico", "https://www.microsoft.com/favicon.ico" )- gUPTANew Member
This worked great, thank you so much!
Is there any way to get the measure to respond dynamically to other filters? For example if I have page-level filters in the report?
Right now it seems the AvgOfDays variable is static, so it doesn't respond to other filters in the page, so the icons don't change in response to other filters on the page.
- v-chuncz-msftCommunity Support
Add a measure below, and use conditional formatting instead.
Measure = SIGN ( AVERAGE ( Table1[Num of Days] ) - 90 )
- pcraokjrFrequent Visitor
Hi
but unfortunately calculated column is not displaying the right KPI Indicators icon, Always its showing me same icon(let’s say Red or Green) irrespective of my return value(Index) in below query.
Same query if I created as calculated Measure it works fine but calculate measure not displaying the icon and displaying url as plain text due to limitation on type.
Is anyone faced similar issue to display KPI Indicators icons…if so Please provide solution
KPI Icon =
VAR Index = IF( [Variance] >0 , 1 ,0)
RETURN
SWITCH (
TRUE (),
Index = 0, "https://kjrsw/Red.png",
"https://kjrsw/Green.png"
)