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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
JohanSmith7
Frequent Visitor

Formatting the result based on user selection

Hi, I need to show different units for a value based on user selection (Thousands (K), Millions(M), Billions(B), 

I have created the measure that gives the result that needs to be formatted: to have this result, the user selects from a slicer that contains 4 possible options and the formula returns the value.

 

 

 

Dmnd_Supply_Related_Test = 

VAR val = 
    SWITCH(
        TRUE,
        SELECTEDVALUE('Slicer - Options'[Code]) = 1, SUM(pio_excess_rootcause_gei[Dmnd_supply_related]),
        SELECTEDVALUE('Slicer - Options'[Code]) = 2, SUMX(tblSCHist_InvMetrics, tblSCHist_InvMetrics[excessGEI] * tblSCHist_InvMetrics[cost_aswas]),
        SELECTEDVALUE('Slicer - Options'[Code]) = 3, SUM(pio_excess_rootcause_gei[excessContribution]),
        SELECTEDVALUE('Slicer - Options'[Code]) = 4, SUM(pio_excess_rootcause_gei[UNIT_COST_LOCAL_Related_Sum])
    )


RETURN
     (val / SELECTEDVALUE('Slicer - Display Units'[Denominator]))

 

 

 

 The value val returned in the switch part is divided by the units slicer that allows to select (Thousands, Millions, Billions) and it takes the denominator (1K, 1M, 1B) accordingly to have at the end the value.

 

The challenge comes when I try to use this value in a visual, let's say that the switch returns the first option evaluated and the user selected Millions in the slicer, the visual is returning the correct value, but I need to show for example (first bar from the chart below) 163.46 M and if is selected Thousands it should show at the end of the number the word "K" and "B" if Billions option is selected but I'm only getting the number without these words.

The Display units property of the visual is set to None, I have tried changing this property to Auto and other options but not getting the expected result, I have the feeling that I need to formatt directly from the formula in the return part but not sure how to formatt from there.

JohanSmith7_0-1683036996395.png

 

Any idea is highly appreciated,

Thanks,

 

0 REPLIES 0

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.