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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request 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
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors