Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
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
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
11 | |
11 | |
10 | |
9 | |
8 |
User | Count |
---|---|
17 | |
12 | |
11 | |
11 | |
11 |