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
JB_AT
Helper III
Helper III

Dynamic Format Measures

Hi

I have a measure that I would like to format dynamically when a value in a slicer is chosen. The value in the slicer when chosen will divide the result of the measure by 1, 1000 or1000000. The measure Format is Dynamic and I have entered the dax below to format it, which doesn't work as expected.

SWITCH(
    SELECTEDVALUE ( NumberFormatCalc[Format] ),
            "Ones", FORMAT ( ROUND ( [Actuals Calc], 0 ), "0,0" ),
            "Thousands", FORMAT ( ROUND ( DIVIDE ( [Actuals Calc], 1000 ), 0 ), "0,0" ),
            "Millions", FORMAT ( ROUND ( DIVIDE ( [Actuals Calc], 1000000 ), 1 ), "0.0" )
        )

Any ideas on what i can do here?


 

Thanks

2 ACCEPTED SOLUTIONS
some_bih
Super User
Super User

Hi @JB_AT  check link





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

Proud to be a Super User!






View solution in original post

Anonymous
Not applicable

Hi @JB_AT 

 

First of all, thanks to @some_bih for your timely and effective response.

 

Here is my testing.

 

My sample:

 

slicer table:

vxuxinyimsft_0-1710382878861.png

 

data table:

vxuxinyimsft_1-1710382904455.png

 

I don't have your source data, so I don't know how [Actuals Calc] is obtained, so I created the following formula just to get a measure.

Actuals Calc1 = SUM('Table'[Actuals Calc])

 

Then I modified your formula.

measure = SWITCH(
    SELECTEDVALUE ( NumberFormatCalc[Format] ),
            "Ones", FORMAT(ROUND ( [Actuals Calc1], 1 ), "0.0"),
            "Thousands", FORMAT(ROUND ( DIVIDE ( [Actuals Calc1], 1000 ), 1 ), "0.0"),
            "Millions", FORMAT(ROUND ( DIVIDE ( [Actuals Calc1], 1000000 ), 1 ), "0.0")
        )

 

Result:

vxuxinyimsft_2-1710383102305.png

 

 

vxuxinyimsft_3-1710383119004.png

 

vxuxinyimsft_4-1710383136230.png

 

Is this the result you expect?

 

If I've misunderstood you, please provide detailed sample data and the results you are hoping for: How to provide sample data in the Power BI Forum - Microsoft Fabric Community . Or show it as a screenshot or pbix. Please remove any sensitive data in advance. If uploading pbix files please do not log into your account.

 

Best Regards,
Yulia Xu

 

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

View solution in original post

4 REPLIES 4
JB_AT
Helper III
Helper III

Thank you @some_bih 

 

I actually came across this article this week and didn't read it. It is a big help!

 

Thanks

Anonymous
Not applicable

Hi @JB_AT 

 

First of all, thanks to @some_bih for your timely and effective response.

 

Here is my testing.

 

My sample:

 

slicer table:

vxuxinyimsft_0-1710382878861.png

 

data table:

vxuxinyimsft_1-1710382904455.png

 

I don't have your source data, so I don't know how [Actuals Calc] is obtained, so I created the following formula just to get a measure.

Actuals Calc1 = SUM('Table'[Actuals Calc])

 

Then I modified your formula.

measure = SWITCH(
    SELECTEDVALUE ( NumberFormatCalc[Format] ),
            "Ones", FORMAT(ROUND ( [Actuals Calc1], 1 ), "0.0"),
            "Thousands", FORMAT(ROUND ( DIVIDE ( [Actuals Calc1], 1000 ), 1 ), "0.0"),
            "Millions", FORMAT(ROUND ( DIVIDE ( [Actuals Calc1], 1000000 ), 1 ), "0.0")
        )

 

Result:

vxuxinyimsft_2-1710383102305.png

 

 

vxuxinyimsft_3-1710383119004.png

 

vxuxinyimsft_4-1710383136230.png

 

Is this the result you expect?

 

If I've misunderstood you, please provide detailed sample data and the results you are hoping for: How to provide sample data in the Power BI Forum - Microsoft Fabric Community . Or show it as a screenshot or pbix. Please remove any sensitive data in advance. If uploading pbix files please do not log into your account.

 

Best Regards,
Yulia Xu

 

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

Thank you @Anonymous 

 

This helps a lot.

 

some_bih
Super User
Super User

Hi @JB_AT  check link





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

Proud to be a Super User!






Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 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.