Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

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.

Reply
david_MAS
Frequent Visitor

Var Formula error

Hi All,

 

I have a measure where the user would be able to display a value of their choice within a linked MAtrix table. 

 

My issue is that one of the option links to a percent measure but the others are decimal number format. What I want to do is amend the code to format 3 of the selections as Decimal Number and the 4th (in red) as Percentage.

Selected Metric = 
VAR MySelection = 
SELECTEDVALUE('Select Metric'[Measure])
Return
SWITCH (
TRUE (),
MySelection = "Volumes",[Volume YTD],
MySelection = "Forecast",[Cumulative Forecast],
MySelection = "% Forecast Met",[Ytd % Forecast Met],MySelection = "Variance",[Cumulative Variance],
[Volume YTD]
)

thanks in advance for any assistance offered.

 

Cheers

1 ACCEPTED SOLUTION
v-jiascu-msft
Employee
Employee

Hi @david_MAS,

 

If you just want to show the number as a percentage, you can try this formula.

Selected Metric =
VAR MySelection =
    SELECTEDVALUE ( 'Select Metric'[Measure] )
RETURN
    SWITCH (
        MySelection,
        "Volumes", [Volume YTD],
        "Forecast", [Cumulative Forecast],
        "% Forecast Met", FORMAT ( [Ytd % Forecast Met], "0.00%" ),
        "Variance", [Cumulative Variance],
        [Volume YTD]
    )

Var-Formula-error

 

Best Regards,

Community Support Team _ Dale
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-jiascu-msft
Employee
Employee

Hi @david_MAS,

 

If you just want to show the number as a percentage, you can try this formula.

Selected Metric =
VAR MySelection =
    SELECTEDVALUE ( 'Select Metric'[Measure] )
RETURN
    SWITCH (
        MySelection,
        "Volumes", [Volume YTD],
        "Forecast", [Cumulative Forecast],
        "% Forecast Met", FORMAT ( [Ytd % Forecast Met], "0.00%" ),
        "Variance", [Cumulative Variance],
        [Volume YTD]
    )

Var-Formula-error

 

Best Regards,

Community Support Team _ Dale
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Awesome! Thank you, that's done the job.

 

Thanks

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.