March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
Hello!
I have a problem with some visualizations, how can I make that when I select "sales" or "quantity" the format of the measurements is displayed correctly?
I created some daxes, but if I select "sales" in the slicer, the data figures should be displayed in currency format. And if I select "quantity" the format should be a whole number, but this doesn't work well.
I share with you the .pbix
https://drive.google.com/drive/folders/1HeccYaKR3eNvJpec9mEJMENbzVQ6MBPE?usp=sharing
I hope you can help me, please!
Solved! Go to Solution.
Hello x-datita! I see that you are having trouble with formatting your measures in Power BI. One way to solve this issue is by using dynamic format strings for measures. This feature allows you to use a DAX expression to determine the format string that a measure will use1. To use this feature, you need to go to File > Options and settings > Options > Preview features and check the box next to Dynamic format strings for measures1. Once you have enabled this feature, you can add a dynamic format string to a measure by clicking on the measure in the Data pane, then going to the Measure tools ribbon, expanding the Format list box, and choosing Dynamic2. A new list box should appear to the left of the DAX formula bar with Format selected. This list box is how you can switch between the measure DAX expression and the dynamic format string DAX expression2. You can then overwrite the pre-populated string with whatever DAX expression will output the desired format string for your measure1.
Hi @x-datita ,
Please use below dax formual for the measure dynamic format(Create dynamic format strings for measures in Power BI Desktop - Power BI | Microsoft Learn)
VAR tmp =
SELECTCOLUMNS ( Medida, "Media", [Medida] )
VAR _str =
CONCATENATEX ( tmp, [Media] )
RETURN
SWITCH ( _str, "Sales", "$#,0.00", "Quantity", "#,0.00" )
Result:
Please refer the attached .pbix file.
Best regards,
Community Support Team_Binbin Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @x-datita ,
Please use below dax formual for the measure dynamic format(Create dynamic format strings for measures in Power BI Desktop - Power BI | Microsoft Learn)
VAR tmp =
SELECTCOLUMNS ( Medida, "Media", [Medida] )
VAR _str =
CONCATENATEX ( tmp, [Media] )
RETURN
SWITCH ( _str, "Sales", "$#,0.00", "Quantity", "#,0.00" )
Result:
Please refer the attached .pbix file.
Best regards,
Community Support Team_Binbin Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Thank you!!
It works very well
Hello x-datita! I see that you are having trouble with formatting your measures in Power BI. One way to solve this issue is by using dynamic format strings for measures. This feature allows you to use a DAX expression to determine the format string that a measure will use1. To use this feature, you need to go to File > Options and settings > Options > Preview features and check the box next to Dynamic format strings for measures1. Once you have enabled this feature, you can add a dynamic format string to a measure by clicking on the measure in the Data pane, then going to the Measure tools ribbon, expanding the Format list box, and choosing Dynamic2. A new list box should appear to the left of the DAX formula bar with Format selected. This list box is how you can switch between the measure DAX expression and the dynamic format string DAX expression2. You can then overwrite the pre-populated string with whatever DAX expression will output the desired format string for your measure1.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
User | Count |
---|---|
27 | |
17 | |
16 | |
12 | |
11 |
User | Count |
---|---|
38 | |
29 | |
22 | |
20 | |
18 |