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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
AlB
Community Champion
Community Champion

Measure invoking other measures with different output formats - Presentation in chart

Hi all,

We have a measure that calls on 3 other different measures depending on the selection of a slicer.

Slicer table

  Measure 1

  Measure 2

  Measure 3 

 

So the user can select the measure to apply by selecting its name in the slicer. The main measure code is then something like: 

 

 

 

MultiMeasure =
SWITCH (
    SELECTEDVALUE ( SlicerTable[Metric] ),
    "Measure 1", [Measure 1],
    "Measure 2", [Measure 2],
    "Measure 3", [Measure 3]
)

 

Then we use this [MultiMeasure] in a line chart, with date in the X axis for instance.

Now the problem is that [Measure 1] returns a large integer while [Measure 2] returns a percentage.

If we format [MultiMeasure] as a %, it will show nicely when the selected measure is [Measure 2] but not when [Measure 1] is selected. And viceversa if we format [MultiMeasure] as an integer. 

Does anyone know a way to get around this? Ideally we would want to have a sort of dynamic formatting for [MultiMeasure], so that it shows as % in the chart when the selection is Measure 2 and as a whole number when the selection is Measure 1

FORMAT cannot be use because it returns text and we are plotting in a chart, that requires numbers

 

Many thanks

 

@TomMartens @MFelix @Greg_Deckler 

2 ACCEPTED SOLUTIONS
MFelix
Super User
Super User

Hi @AlB ,

 

You need to use the calculated groups check this post were I have made an explanation about it:

 

https://community.powerbi.com/t5/Desktop/How-to-dynamically-set-the-format-of-a-measure-in-a-Power-B...

 

 

 

 


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



View solution in original post

Hi @AlB ,

 

You don't need to use the field from the Calculated groups on the legend I just did that for example purposes if you want to show more than one measure, what you need to do is the basis measure to your chart add the legend values that you need and then use the Calculated group as a slicer on your report.

 

What is the type of chart you are using?

 

 


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



View solution in original post

7 REPLIES 7
v-kelly-msft
Community Support
Community Support

Hi @AlB ,

 

Try to modify your measure as below:

MultiMeasure =
SWITCH (
    SELECTEDVALUE ( SlicerTable[Metric] ),
    "Measure 1", [Measure 1],
    "Measure 2", FORMAT([Measure 2],"percent"),
    "Measure 3", [Measure 3]
)

And you will see:

Screenshot 2020-11-02 164038.pngScreenshot 2020-11-02 164055.png

Best Regards,
Kelly

Did I answer your question? Mark my post as a solution!

 

AlB
Community Champion
Community Champion

Hi @v-kelly-msft 

Thanks for your suggestion.

Your approach is not valid because it returns text. I need it to return a number, since the result goes into a chart. @MFelix  suggestion works great but I now have the problem that I described earlier; I already have another field in the legend of the chart.

Thanks

 

Hi @AlB ,

 

You don't need to use the field from the Calculated groups on the legend I just did that for example purposes if you want to show more than one measure, what you need to do is the basis measure to your chart add the legend values that you need and then use the Calculated group as a slicer on your report.

 

What is the type of chart you are using?

 

 


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



AlB
Community Champion
Community Champion

Thanks@MFelix

I'm using simple charts, either line or stacked column charts.

Ok, that makes sense. I'll try it out with the slicers from the calc group.

 

 

In the tests I have made everything worked correctly. but again the data itself has you now may change the result.

 

Also check this post about formatting can give you some hints.

 

https://www.sqlbi.com/articles/controlling-format-strings-in-calculation-groups/


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



MFelix
Super User
Super User

Hi @AlB ,

 

You need to use the calculated groups check this post were I have made an explanation about it:

 

https://community.powerbi.com/t5/Desktop/How-to-dynamically-set-the-format-of-a-measure-in-a-Power-B...

 

 

 

 


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



AlB
Community Champion
Community Champion

@MFelix 

Thanks a lot for your answer. In the example, you place the column from the calculated group table in the legend of the chart. I have another field that is being used in the legend and has to stay in the legend. Is there a work around for that? CAn it still be done if you need something else in the legend?

Many thanks

 

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors