Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Dear PBI Community!
I have the following switch-measure which is used to show different financial and volume measures within one and the same visual.
What I am looking to do is have "(Selected) Value" be formatted with 2 decimals IF "volume" is selected from the dropdown and show no decimals if any other of the values is selected (Revenue, CM or GP).
Could you please help me accomplish this in the DAX below?
(Selected) Value =
VAR Selection = SELECTEDVALUE('Dim_Measure_Selection_Master'[Value Types], "ALL" )
RETURN
SWITCH(true(),
Selection = "Volume", [Volume (MT)],
Selection = "Revenue", [Total Revenue ($)],
Selection = "Contribution Margin", [Total Contribution Margin ($)],
Selection = "Gross Profit", [Total Gross Profit ($)],
[Total Contribution Margin ($)]
)
Thank you very much!
Solved! Go to Solution.
Use the FORMAT function to get the result, but the best way is to use calculate group
Thank you for the prompt reply! I tried this however get an error, will the Format function make my measure into text?
Error Message:
MdxScript(Model) (110, 1) Calculation error in measure '_Measure_Selection_Cycle'[(Selected) Value]: Cannot convert value '' of type Text to type Numeric/Date.
yes the return value type of format is string
Use the FORMAT function to get the result, but the best way is to use calculate group
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
42 | |
21 | |
21 | |
14 | |
13 |
User | Count |
---|---|
43 | |
36 | |
33 | |
18 | |
18 |