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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
CStillman
Frequent Visitor

Dispaly SVG Image or Text Within Same Matrix Column

I have a DAX expression which renders a SVG image or displays a number depending on the scope of the row. I am able to get the number to display, but instead of the image displaying, the SVG markup gets displayed. InScope is categorized correctly as an Image URL and I am able to display only the image if I program my DAX expression as InScope = [BlueBox]. This tells me that the measure is defined and categorized correctly. I am scratching my head trying to get this to work. I know it shouldn't be this problematic. Any suggestions? TIA

 

Dax Expression:

InScope = IF ( AND ( ISINSCOPE('Employee'[Name]), [Assigned] = 1 ), [BlueBox] , [Assigned] )
 

Resulting Matrix (also showing that my SVG images do render correctly):

CStillman_0-1726874928603.png

 

 

 

 

 
1 ACCEPTED SOLUTION

You need to render your text via SVG as well.  You cannot mix column types.

View solution in original post

3 REPLIES 3
lbendlin
Super User
Super User

You are missing quite a bit of the SVG boilerplate code  (like the viewbox)

 

Use SVG Images in Power BI: Part 3 - DataVeld

Thanks for the reply @lbendlin. How would adding more of the boilerplate code to the image help? I still don't think it would render correctly. As you can see, as it's currently defined, it renders fine when used on its own. It's the combination of displaying the image or text within the same column that is causing the problem.

 

I now think it has more to do with displaying the value than displaying the image. I tweaked my expression, hard coding the value as a string. This changed the measures format from General to Text.

 

InScope = IF (  AND (  ISINSCOPE('Head Count Combined'[PAYROLL_NAME]) , [Assigned New] = 1  ) , [BlueBox]  , "6" )
 
Now the images display appropriately but the values don't (there should be a 6 at each placeholder).
CStillman_2-1726885988212.png

 


 

You need to render your text via SVG as well.  You cannot mix column types.

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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