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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
peterg0417
Helper III
Helper III

Can't get negative basis points in parentheses to show properly

Just got a request from leadership to change the way our basis points are displayed. A third party vendor created this model and I'm tasked with managing it going forward.

Here is the DAX formula they created:

 

YTD Growth =
VAR FormatToUse =
    IF (
        SELECTEDVALUE ( 'Key Statistics'[Key Statistic] ) = "NAV",
        "0.0%;(0.0%);-",
        "0bps"
    )
RETURN
    IF (
        OR ( [YTD Growth Number KS] = 0, ISBLANK ( [YTD Growth Number KS] ) ),
        "-",
        FORMAT (
            [YTD Growth Number KS]
                * IF ( FormatToUse  = "0bps", 10000, 1 ),
            FormatToUse
        )
    )
 
The result of this query is:
peterg0417_3-1668700128453.png
 
When it's a percentage, the it displays the correct format. Eg. (55.5%) for a negative 55%. But for basis points (bps) I can't get it to work when I try modifying the variable to this:
VAR FormatToUse =
    IF (
        SELECTEDVALUE ( 'Key Statistics'[Key Statistic] ) = "NAV",
        "0.0%;(0.0%);-",
        "0bps;(0bps)"
    )
RETURN
 
Then modify the IF statement further on:
IF (
        OR ( [YTD Growth Number KS] = 0, ISBLANK ( [YTD Growth Number KS] ) ),
        "-",
        FORMAT (
            [YTD Growth Number KS]
                * IF ( FormatToUse IN { "0bps", "(0bps)"}, 10000, 1 ),
            FormatToUse
        )
    )
 
The result I get is this:
peterg0417_2-1668699905370.png

 


The expected result where it's highlighted is (10,000bps) and (8,182bps). For some reason, in the IF statement, it's not recognizing the negatives, and it's just multiplying by 1, as opposed to 10000 like it's supposed to do.

 

Any ideas on how to get this to work?

 

Thx

1 ACCEPTED SOLUTION
Greg_Deckler
Community Champion
Community Champion

@peterg0417 Should be this: 

 * IF ( FormatToUse IN { "0bps;(0bps)"}, 10000, 1 ),


Follow on LinkedIn
@ 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!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Hi @peterg0417 ,
Try modifying your IF statement as below: 

IF (
        OR ( [YTD Growth Number KS] = 0ISBLANK ( [YTD Growth Number KS] ) ),
        "-",
        FORMAT (
            [YTD Growth Number KS]
                * IF ( FormatToUse ="0bps;(0bps)"100001 ),
            FormatToUse
        )
    )
Greg_Deckler
Community Champion
Community Champion

@peterg0417 Should be this: 

 * IF ( FormatToUse IN { "0bps;(0bps)"}, 10000, 1 ),


Follow on LinkedIn
@ 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!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Ahh yes, that makes sense

 

This whole custom formatting is very new to me so thank you for the quick solution

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

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
Top Kudoed Authors