Forum Discussion
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
- Anonymous2 years ago
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 XuIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
4 Replies
- AnonymousNot 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:
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 XuIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- JB_ATHelper III
Thank you Anonymous
This helps a lot.
- some_bihCommunity Champion