Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.
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
Solved! Go to Solution.
Proud to be a Super User!
Hi @JB_AT
First of all, thanks to @some_bih for your timely and effective response.
Here is my testing.
My sample:
slicer table:
data table:
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:
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 @some_bih
I actually came across this article this week and didn't read it. It is a big help!
Thanks
Hi @JB_AT
First of all, thanks to @some_bih for your timely and effective response.
Here is my testing.
My sample:
slicer table:
data table:
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:
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.