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

Data Days is here! Join us now for 60+ days of learning, challenges, and connection. Learn more

Reply
486kyoko
Regular Visitor

Format Different format for decimal

Hello,

 

I have to present the number differently. Number without Decimial (ie 0 decimal) and with Decimal. 

 

in this example if category = "TRIFR" 

 

then SUM value with decimal 0.002022-10-18_15-08-03.png

 

if not "TRIFR" then no decimal.

 

I understand i need to use IF & FILTER & FORMAT.

 

Measure2 =
VAR
Injuries = FILTER(ALL('Category Order'[Category]),'Category Order'[Category] = "Injuries")
VAR
TRIFR = FILTER(ALL('Category Order'[Category]),'Category Order'[Category] = "TRIFR")
VAR
HiPo = FILTER(ALL('Category Order'[Category]),'Category Order'[Category] = "HiPo")
VAR
Equip = FILTER(ALL('Category Order'[Category]),'Category Order'[Category] = "Equip")
VAR
Enviro = FILTER(ALL('Category Order'[Category]),'Category Order'[Category] = "Enviro")
VAR
Hours = FILTER(ALL('Category Order'[Category]),'Category Order'[Category] = "Hours")
Return
Format(CALCULATE([sum Measure],TRIFR),"0.0")
 
this is what i have so far??? and the result is shown below....
 
2022-10-18_16-41-26.png
 

 

 
4 REPLIES 4
johnt75
Super User
Super User

You could create a calculation group with a different calculation item for each category. Each calculation item can have a different format string, and that format string can even include DAX so you could put any additional logic you needed in there.

thanks for comments. so you meant I need to create 6 calculation (or measures) with different format strings... then what you mean by putting additional logic in where?? in the Var/Return measure?

they wouldn't be measures, they would be calculation items in a calculation group. each calculation item has a format string expression which you can set in Tabular Editor when you create the item. that format string expression can contain DAX, so you can put IF or SWITCH statements in there if you need to.

Thanks again for reply. unfortunately i cannot download the external tool as company IT policy. I am seeking a solution from basic DAX code now. Thank you for help.

Helpful resources

Announcements
Fabric Data Days is here Carousel

Fabric Data Days 2026

Don't miss out on Data Days, June 15 through August 7. Learn Fabric, Power BI, SQL, AI and more.

May Power BI Update Carousel

Power BI Monthly Update - May 2026

Check out the May 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.