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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
Anonymous
Not applicable

Measure works in table but not chart

I've got a table with multiple different data types. The table looks like this:

stat_typeNameValue
DecimalZXC1.5
DecimalQWE5.6
PercentageTYU0.80


And DAX code like this:

Switch_value =

VAR stat_type = SELECTEDVALUE(data[stat_type])

VAR p = FIND ("Percent", stat_type, 1, 2) // in my case not all values are as clear but a percent but it starts with that.

VAR _d = SELECTEDVALUE(CIA[value])

return

IF(p == 1, FORMAT(SUM(CIA[Percentage_of_value]), "Percent" ), FORMAT(_d, "Fixed"))


I can see from a card on the page it correctly works out the stat type, then the correct part of the if statement is found. When using a table it works fine. But whenever I use any type of graph, its blank. Anyone know why / how to fix it?

 

1 REPLY 1
johnt75
Super User
Super User

FORMAT returns a string, so the value passed in to the graph would not be numeric. You could either have seperate measures which perform calculations on the different types, or you could look at creating a calculation group and use format string expression on the calculation item. You can use DAX inside the format string expression so you can return different format strings depending on logic.

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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