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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
admiralman
Advocate II
Advocate II

Formatting Measures

I have a measure...call it Current Year Actuals that I need formatted "$#,##0;($#,##0)" and a Budget measure formatted the same way. I have accomplished this and it appears perfectly on the report. However, I need to use these measures in another measure "(Current Year - Budget) / Budget" within a calculation. I receive an error saying it cannot convert the value of type text to type number. I could create the new measure by repeating the same calculations as I did in each base measure but that seems so redundant. Is there not any way to use the base measures and still have them formatted the way I want? Thanks in advance.

5 REPLIES 5
Greg_Deckler
Super User
Super User

Sample data would help, but it seems like the default Currency format would work. And that will not impact other calculations.


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Mastering Power BI 2nd Edition

DAX is easy, CALCULATE makes DAX hard...

Let's assume that the default formats don't satisfy my needs. I need manual formatting control over the measure(s) but still need them to calculate when used for other measures. 

hi, @admiralman @Greg_Deckler

 

COME ON.....

1. Create a table named DM_INDICADOR, in this table it will record the measurements that you want to use in your panels, it must have 2 fields: DM_INDICADOR [ID_INDICADOR], DM_INDICADOR [NAME_INDICADOR]. You can use Excel to mount the table.

2. Record the measurements you will use, such as 1; SLI_VOLUME; 2; SLI_GROSSSALES; 3; SLI_NETSALES; 4; SLI_GROSSPRICE etc.

3. Import this table and create a filter;

4. For each registered measure you must create the respective measure / calculation with the same name of course.

5. Create a measure to identify which measure you are going to consult. 

Indicador_Selected = 
IF(HASONEVALUE(dm_INDICADOR[NOME_INDICADOR]);
SWITCH(VALUES(dm_INDICADOR[ID_INDICADOR]);
1; [SLI_VOLUME]; 2;[SLI_GROSSSALES];3; [SLI_NETSALES];4;[SLI_GROSSPRICE];5;[SLI_NETPRICE];
6; [SLI_NETCOGS];7; [SLI_MARGIM_PERCENT];8;[SLI_TAXPRICE]
); 0)

 

6. Create a measure to identify the formatting that you will use in the selected bookmark. 

Indicador_Format = 
IF(HASONEVALUE(dm_INDICADOR[NOME_INDICADOR]);
SWITCH(VALUES(dm_INDICADOR[ID_INDICADOR]);
1; "#.###"; 2;"#,###.00";3; "#,###.00";4;"#,###.00";5;"#,###.00";
6; "#,###.00";7; "0.00%";8;"0.00%"); "#.###")


7. Create the measure that you have chosen and you will present it in the tables or graphs of the panels. 

XIndicator = FORMAT ([Indicator_Selected]; [Indicator_Format])

 

Ready!

 

Please try and test using it. And please mark the right reply as answer if your issue has been resolved, otherwise, please feel free to ask if you have any other issue.

Best Regards,
Rfranca

 

thanks but I dont think that will work for me. I need all three measures in a matrix and cannot use a filter to pick and choose which one to show.

hi, @admiralman

 

sorry for the inconvenience

 

Have you tried this?

Power KPI Matrix - Microsoft Corporation

 

Best Regards,
Rfranca

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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