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

Level up your Power BI skills this month - build one visual each week and tell better stories with data! Get started

Reply
JamesBurke
Helper III
Helper III

Formatting issue

Hi All , 

 

Created a custom column using format

 

 

Rounded data = 
VAR _Var = 'Emporia Device Usage'[Usages KWH]
    RETURN
    SWITCH(
        TRUE(),
         _Var < 0.01  , FORMAT('Emporia Device Usage'[Usages KWH], "0"),
         _Var < 1 , FORMAT('Emporia Device Usage'[Usages KWH], "0.##"),
        _Var < 10 , FORMAT('Emporia Device Usage'[Usages KWH], "##.##"),
        _Var < 100, FORMAT('Emporia Device Usage'[Usages KWH],"##.#"),
        _Var > 100 ,Format('Emporia Device Usage'[Usages KWH],"###"))

 

But recieve errors like below 

 

Screenshot 2024-10-24 101011.png

 

Thanks , James. 

1 ACCEPTED SOLUTION
shafiz_p
Super User
Super User

Hi @JamesBurke The Format function in Power BI DAX converts the data type to a string. This function is used to format a value as a string according to a specified format. Your measure [Total Kwh] most problably summing up your calculated column which is techincally not possible.

To overcome this situation, use sumx and value function to evaluate sum. For example:

 

Total = SUMX(
    orders,
    VALUE(orders[StringOrder])
)

 

Here orders[StringOrder] column have used format function and data type is text.

 


Hope this helps!!

If this solved your problem, please accept it as a solution!!

 

 

Best Regards,
Shahariar Hafiz

View solution in original post

2 REPLIES 2
shafiz_p
Super User
Super User

Hi @JamesBurke The Format function in Power BI DAX converts the data type to a string. This function is used to format a value as a string according to a specified format. Your measure [Total Kwh] most problably summing up your calculated column which is techincally not possible.

To overcome this situation, use sumx and value function to evaluate sum. For example:

 

Total = SUMX(
    orders,
    VALUE(orders[StringOrder])
)

 

Here orders[StringOrder] column have used format function and data type is text.

 


Hope this helps!!

If this solved your problem, please accept it as a solution!!

 

 

Best Regards,
Shahariar Hafiz

Tahreem24
Super User
Super User

@JamesBurke  What's the data type of 'Emporia Device Usage'[Usages KWH] column?

 

Don't forget to give thumbs up and accept this as a solution if it helped you!!!

Please take a quick glance at newly created dashboards : Restaurant Management Dashboard , HR Analytics Report , Hotel Management Report, Sales Analysis Report , Fortune 500 Companies Analysis , Revenue Tracking Dashboard

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

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

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

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.