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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
Anonymous
Not applicable

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
Microsoft Employee
Microsoft Employee

Hi @Anonymous,

 

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
Microsoft Employee
Microsoft Employee

Hi @Anonymous,

 

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.
Anonymous
Not applicable

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

 

Thanks

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Fabric Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.