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

July 28 - August 9 | Final Round of the Power BI Dataviz World Championships. This is your chance. Learn more

Reply
Anonymous
Not applicable

Using var and format

Hi Community, 

 

I'm trying to create measures using variables in Power BI, but in the final result I'm not able to save the result as a numerical value which is not allowing me to aggregate the values. I used format and values both the options.

 

Please help how to fix this.

 

 

1 ACCEPTED SOLUTION

Remove the call to FORMAT() as that is what is converting the result to a string. Instead set the formatting of the measure using the Formatting section of the Modeling tab in the ribbon

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

 

RETURN
SWITCH(TRUE(),
MAX('P&L MAPPING'[ACC DESCRIPTION])="TOTALVOLLY",FORMAT(TOTALVOL_LY,"###0.##0"),
MAX('P&L MAPPING'[ACC DESCRIPTION])="TOTALGTOLY",FORMAT(TOTALGTO_LY/1000,"###0.##0")


RETURN
SWITCH(TRUE(),
MAX('P&L MAPPING'[ACC DESCRIPTION])="TOTALVOLLY",VALUE(FORMAT(TOTALVOL_LY,"###0.##0")),
MAX('P&L MAPPING'[ACC DESCRIPTION])="TOTALGTOLY",VALUE(FORMAT(TOTALGTO_LY/1000,"###0.##0"))

 

Capture.PNG

Hi @Anonymous ,

 

Please format the value here.

forma.PNG

 

If it doesn't meet your requirement,  kindly share your sample data and excepted result to me if you don't have any Confidential Information. Please upload your files to One Drive and share the link here.

 

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

Remove the call to FORMAT() as that is what is converting the result to a string. Instead set the formatting of the measure using the Formatting section of the Modeling tab in the ribbon

mussaenda
Community Champion
Community Champion

@Anonymous,

 

Please provide more details so everyone can help you better.

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.

Fabric Community Sticker Design Challenge Barcelona Carousel

Fabric Community Sticker Challenge - Barcelona 2026

If you love stickers, then you will definitely want to check out our community sticker challenge, Barcelona edition!

July Power BI Update Carousel

Power BI Monthly Update - July 2026

Check out the July 2026 Power BI update to learn about new features.

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.

Top Solution Authors