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
nrenaud
Helper I
Helper I

Designating Value Types in a Measure

Hello! I am using the following measure to display data in a matrix (along with other measures). This measure displays the values I am looking for, however, some of the values are currency, some are decimal numbers, and some are a percentage. On my matrix, it only displays as decimal numbers (general).

 

CurrentYear Value =
SWITCH (
MAX ( 'Column/Measure Name'[Measure Name] ),
"Billings", SUM ( Table[Billings] ),
"Cash Rec", SUM ( Table[Cashrec] ),
"PL", SUM ( Table[PL] ),
"SO", SUM ( Table[SO] ))


Is there a way to display the correct format for each value in matrix? I have tried CURRENCY(value) in this measure for the lines that should be shown as such, however that does not seem to work. Is that possible to do in a measure like this?

Thanks in advance!

1 ACCEPTED SOLUTION
dedelman_clng
Community Champion
Community Champion

Hi @nrenaud  - 

 

You should be able to use the FORMAT function around your values to get the desired result.  There's a good explanation on how it works here, including some examples: https://dax.guide/format/ 

 

2020-08-20 12_52_11-scratch2 - Power BI Desktop.png2020-08-20 12_53_02-scratch2 - Power BI Desktop.png

 

Fmt Measure = SWITCH(SELECTEDVALUE(MType[MType]), 
    "Amount", FORMAT(SUM(Dates[Amount]), "$#,0.00"), 
    "Percent", FORMAT(SUM(Dates[Percent]), "Percent"))

 

Hope this helps

David

View solution in original post

2 REPLIES 2
dedelman_clng
Community Champion
Community Champion

Hi @nrenaud  - 

 

You should be able to use the FORMAT function around your values to get the desired result.  There's a good explanation on how it works here, including some examples: https://dax.guide/format/ 

 

2020-08-20 12_52_11-scratch2 - Power BI Desktop.png2020-08-20 12_53_02-scratch2 - Power BI Desktop.png

 

Fmt Measure = SWITCH(SELECTEDVALUE(MType[MType]), 
    "Amount", FORMAT(SUM(Dates[Amount]), "$#,0.00"), 
    "Percent", FORMAT(SUM(Dates[Percent]), "Percent"))

 

Hope this helps

David

TomMartens
Super User
Super User

Hey @nrenaud , 

 

this is not possible out of the box.

You can use format strings in calculation groups, but be aware that calculation groups are complex feature by itself, that only can be unlocked using Tabular Editor.

Here are two links that describe what you are looking for:

Hopefully, this provides some ideas on how to tackle your challenge

 

Regards,

Tom



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany

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.