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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
yves007
Frequent Visitor

how to format the unit of the measure of selected measures in a visual chart

i  have created this measure 

Selected items = if (
HASONEVALUE('Measure selection'[Measure ]),
Switch(
   VALUES ('Measure selection'[Measure ]),
           "Month to Month % change", [MOM_I],
           "Price Index", [Index_I],
           "Year over Year % change", [YOY_I]))
but now i want to format the MOM in the percentage and YOY also in the percentage and leave Price index as it in this measure 
1 ACCEPTED SOLUTION

Hi @yves007 

This seems to be the only solution.
Also, I use it regularly, so it has to work.

 

Here's an example I gave you. Let's try to figure out where things went wrong.

In any case, you can download a sample file from here in addition to the explanation below: Link to file

 

Using a sample file with a table, I built a small table for selecting metrics.

Ritaf1983_0-1684551852193.png

I have just built 3 measures for logical numeric results in:

Ritaf1983_1-1684551967341.png

As I suggested, I wrapped your formula in a format function

Selected items = if (
HASONEVALUE('KPI''S'[KPI]),
Switch(
   VALUES ('KPI''S'),
           "Percent", FORMAT([test_percent 1],"percent"),
           "Number",FORMAT( [TestNumber 1],"#,##0"),
           "curency", format([TestCurre1],"$#,##0")))
Ritaf1983_3-1684552177296.png

Finally, I checked the results using a small kpis table in Slicer and on simple table.
It works perfectly.

Ritaf1983_4-1684552329368.png

If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly



View solution in original post

3 REPLIES 3
Ritaf1983
Super User
Super User

Hi @yves007 
Put the desired result in a function
"format"
Depending on your needs, you can choose any format
Something like : 

Selected items = if (
HASONEVALUE('Measure selection'[Measure ]),
Switch(
   VALUES ('Measure selection'[Measure ]),
           "Month to Month % change",  format ([MOM_I],""Percent")
     ....
 
If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly

it didnt work, is there another way?

Hi @yves007 

This seems to be the only solution.
Also, I use it regularly, so it has to work.

 

Here's an example I gave you. Let's try to figure out where things went wrong.

In any case, you can download a sample file from here in addition to the explanation below: Link to file

 

Using a sample file with a table, I built a small table for selecting metrics.

Ritaf1983_0-1684551852193.png

I have just built 3 measures for logical numeric results in:

Ritaf1983_1-1684551967341.png

As I suggested, I wrapped your formula in a format function

Selected items = if (
HASONEVALUE('KPI''S'[KPI]),
Switch(
   VALUES ('KPI''S'),
           "Percent", FORMAT([test_percent 1],"percent"),
           "Number",FORMAT( [TestNumber 1],"#,##0"),
           "curency", format([TestCurre1],"$#,##0")))
Ritaf1983_3-1684552177296.png

Finally, I checked the results using a small kpis table in Slicer and on simple table.
It works perfectly.

Ritaf1983_4-1684552329368.png

If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly



Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Power BI Monthly Update - May 2024

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