Forum

URL indicator Icon ...
 
Notifications
Clear all

URL indicator Icon on result of measure

2 Posts
2 Users
0 Reactions
55 Views
(@marksl)
Posts: 9
Active Member
Topic starter
 

Hi,

I want to add a simple green or red indicator icon to my Matrix visual, based on the result of a measure which returns a variance percentage of Sales vs Budget.  I currently have the following measure to work out my variance on budget:

Variance On Budget =
VAR __BASELINE_VALUE =
    SUM ( 'SalesFact'[Budget] )
VAR __VALUE_TO_COMPARE =
    SUM ( 'SalesFact'[Sales] )
RETURN
    DIVIDE ( __VALUE_TO_COMPARE - __BASELINE_VALUE, __BASELINE_VALUE )

I have then created 2nd measure to output the icon based on the result of the above:

Budget Indicator =
IF (
    [Variance On Budget] > 0,
    "http://server/green.png",
    "http://server/red.png"
)

When I add the above measure to my table, I can see that it is correctly assigning green or red, however it is outputting the URL string and not the desired icon.  I therefore went to the Modelling ribbon to change the Data Category to "Image URL", however the Data Category drop down is greyed out:

 pbi240418.png

 

 

 

 

 

 

 

 

 

I have already raised this query on the Power BI forum but without much response.  If it is not possible to mark a measure as Image URL, I wondered if I could keep my two URLs in a unrelated table (ImageTable) with say 1 row and two columns ('Green' and 'Red'), with both marked as Image URL.  So some pseudo Dax code something like:

Budget Indicator =
IF (
    [Variance On Budget] > 0,
    FIRST(ImageTable[Green]),
    FIRST(ImageTable[Red])

Is it this hard to get a simple coloured indicator on a report?

Thanks as always,

Mark

 
Posted : 28/04/2018 9:37 am
(@mynda)
Posts: 4761
Member Admin
 

Hi Mark,

The data type needs to be set at the table containing the URL, not the measure. So, yes adding the image URLs to their own table may work/why-is-vba-running-slowly.

That said, have you tried using the conditional formatting in Power BI instead of the images? I know they don't have icons yet, but at least you can color code them and make the column narrow as explained here:

https://blogs.msdn.microsoft.com/charles_sterling/2017/03/17/red-green-yellow-icons-in-power-bi/

Mynda

 
Posted : 30/04/2018 7:42 pm
Share: