Dynamic pop-up or warning images in Power BI
For me, Power BI has become a rather complete tool over the last few years. Some things are still missing though, like pop-up messages. There are no really good solutions to warn or inform users, the classic pop-up just does not exist.
Imagine you have a multi-tenant/client report. Row-level security is managing who has access to which data. Now if you want to restrict access to some pages or some content it can get tricky. Maybe you need to create a warning message or set visuals as "blank" when there is no data.
We did this for a client recently and came up with this solution:
We wanted to dynamically display a warning message if the client had not purchased a data module / report page (and thus no data was shown)
You might think this is really straight-forward however it is not the case.
Additionally, we needed to make this dynamic based on who is looking at the report (via row-level security)
Using a card visual or other "simple" solution was not viable for us for design and other reasons, this is why we had to go with creating a custom error/warning image.
This was our solution:
1) Create your pop-up message in any tool and save it as a .jpg or .png
These tools will convert your image to text and you can store that text in the Power BI Report itself. You can use these technique to display all kinds of images in Power BI without needing to upload anything on a server.
3) Put the binary code into Power BI by creating a table in dax ("Modeling" -> "New table")
ROW( "image code", "data:image/png;base64,<<paste your binary/base64 code here >>")
The text can become super long, there are even limits as outlined here
4) Set data category on the column of the table you created to "Image URL"
5) Create a measure with your condition (based on which the error/warning message should appear)
This can be anything, e.g. Error_measure = IF( [User_Count] >= 1 , 1 , 0 )
If our user count is 1 or more then return 1, else return 0
6) Now we use a custom visual like Image Pro and drag our image column from step 3) into the "Image URL" field - we could visualize the image in a table as well
7) As a last step, we have to make the image appear dynamically, we just drag and drop our measure from 5) into the "Filters on this visual" of our image/custom visual and set the filtered value to 0.
This means that only if we dont have a user count or it is 0 the image will appear and warn the user that this page is not available for him (and we are judging that by the user count e.g.)
This also works with row-level security and multi-tenants, just make sure you find a bulletproof condition to apply.
See in this short video how the message could look like:
You should find a use case for your client or your project and then adapt this solution.
-Try not to use the Simple Image custom visual since it does not update/refresh properly, you might need to refresh the whole page (e.g. in the Power BI Service) - if you have the custom visual and a normal table (where you can also show the picture) side by side you can see how they behave differently - you can see in this video how this visual does not work properly
-Put the message/picture somewhere you do not need any interactivity, if you want the message to work it needs to be on top of any other visual because only then it can be visible. This comes with one big downside however, you cannot interact with any visual underneath it.