Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
moltra_work
Frequent Visitor

Return a certain base 64 icon if a measure is null.

I have a measure like this.

 Product[Icon]IF ( Product[Version] > 1, Product[ProductIcon1], Product[ProductIcon2] )

 

What currently happens since it is a new product, sometimes the Icons are not created yet. What I would like to do is have a generic icon show up if the result of the above measure is null.  The Icons are stored in the Product table in Base 64 format.  

Any Advice on doing this?

 

 

1 ACCEPTED SOLUTION

I will have to try this way and see how it works. 

 

What I have tried and seems to be working is.

 

 Product_Blank =
     IF ( [Product[Icon] == "", [Product_Icon_not_found], Product[Icon] )

View solution in original post

2 REPLIES 2
123abc
Community Champion
Community Champion

Certainly! To achieve this, you can modify your existing DAX measure to include logic that checks if the result is null and, in that case, returns the base 64 representation of your generic icon. Here's an example

 

Product[Icon] =
IF (
NOT ISBLANK ( Product[Version] )
&& ( Product[Version] > 1 )
&& NOT ISBLANK ( Product[ProductIcon1] ),
Product[ProductIcon1],
IF (
NOT ISBLANK ( Product[Version] )
&& ( Product[Version] > 1 )
&& NOT ISBLANK ( Product[ProductIcon2] ),
Product[ProductIcon2],
"base64_representation_of_generic_icon"
)
)

 

In this example, if Product[ProductIcon1] is not blank and the version condition is met, it will use ProductIcon1. If not, it checks for Product[ProductIcon2]. If that is also blank or the version condition is not met, it returns the base 64 representation of your generic icon.

Make sure to replace "base64_representation_of_generic_icon" with the actual base 64 representation of your generic icon.

I will have to try this way and see how it works. 

 

What I have tried and seems to be working is.

 

 Product_Blank =
     IF ( [Product[Icon] == "", [Product_Icon_not_found], Product[Icon] )

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.