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

We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now

Reply
PowerBIET
Frequent Visitor

FORMAT function on Negative Numbers

Why are the negative values blank when using my [Revenue Formatted] measure?  I was expecting the FORMAT to convert into a parenthesis (negative number) based on the formats I applied in the SWITCH function.  Please help me resolve. 

 

OneDrive Link to PBIX: SampleProject.pbix

 

Revenue Formatted =
VAR sales = [.Revenue]
VAR result =
SWITCH(TRUE(),
        sales > 1000000,FORMAT(DIVIDE(sales,1000000,0),"$#.#;($#.#)"),
        sales > 100000,FORMAT(ROUND(DIVIDE(sales,1000000,0),3),"$0.###;($0.###)"),
        sales > 10000,FORMAT(ROUND(DIVIDE(sales,100000,0),2),"$0.###;($0.##0)"),
        sales > 1000,FORMAT(ROUND(DIVIDE(sales,10000,0),1),"$#.#00;($#.#00)"),
        sales = 0.00,0
    )
RETURN
result

 

PowerBIET_1-1735402608056.png

 

 

 

 

 

1 ACCEPTED SOLUTION
rajendraongole1
Super User
Super User

Hi @PowerBIET - To handle negative values, you need to add a condition for sales < 0 or rework the logic so negative values fall through to the appropriate FORMAT string. Here's the corrected measure:

 

VAR sales = [.Revenue]
VAR result =
    SWITCH(
        TRUE(),
        sales > 1000000, FORMAT(DIVIDE(sales, 1000000, 0), "$#.#;($#.#)"),
        sales > 100000, FORMAT(ROUND(DIVIDE(sales, 1000000, 0), 3), "$0.###;($0.###)"),
        sales > 10000, FORMAT(ROUND(DIVIDE(sales, 100000, 0), 2), "$0.##0;($0.##0)"),
        sales > 1000, FORMAT(ROUND(DIVIDE(sales, 10000, 0), 1), "$#.#00;($#.#00)"),
        sales = 0, "0",
        sales < 0, FORMAT(sales, "$#,##0.00;($#,##0.00)")
    )
RETURN
 
rajendraongole1_0-1735404728237.png

 

 

Please find the attached pbix FYR





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





View solution in original post

1 REPLY 1
rajendraongole1
Super User
Super User

Hi @PowerBIET - To handle negative values, you need to add a condition for sales < 0 or rework the logic so negative values fall through to the appropriate FORMAT string. Here's the corrected measure:

 

VAR sales = [.Revenue]
VAR result =
    SWITCH(
        TRUE(),
        sales > 1000000, FORMAT(DIVIDE(sales, 1000000, 0), "$#.#;($#.#)"),
        sales > 100000, FORMAT(ROUND(DIVIDE(sales, 1000000, 0), 3), "$0.###;($0.###)"),
        sales > 10000, FORMAT(ROUND(DIVIDE(sales, 100000, 0), 2), "$0.##0;($0.##0)"),
        sales > 1000, FORMAT(ROUND(DIVIDE(sales, 10000, 0), 1), "$#.#00;($#.#00)"),
        sales = 0, "0",
        sales < 0, FORMAT(sales, "$#,##0.00;($#,##0.00)")
    )
RETURN
 
rajendraongole1_0-1735404728237.png

 

 

Please find the attached pbix FYR





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Helpful resources

Announcements
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.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

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