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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
RickPowerBI
Helper I
Helper I

Two IF scenario's in one column

Two IF scenario's in one column

 

Hi,

 

I am trying to make a column that shows data after two “IF” scenario’s.

 

Quantity

CreditInvoice

IF Column

-11346

False

-11346

23547

True

 

-2716713.62

False

-2716713.62

-1221689

False

-1221689

-105182

False

-105182

-67

False

-67

6

True

 

2752

True

 

-2073.08

False

-2073.08

19512

True

 

-52189

True

52189

-78499

True

78499

 

I need ‘quantity’ above 0:

Where ‘CreditInvoice’ says TRUE, and the ‘Quantity’ is below 0.

As you can see in the last two rows.

 

I don’t want anything changing if the ‘CreditInvoice’ is FALSE.

 

I’ve got that working but that is not the problem,

 

The second IF scenario is:

 

When ’CreditInvoice’ is TRUE but the ‘Quantity’ is already above 0.

How do I do this.

 

I’ve tried the following but is doesn’t work:

 

IF Column =

IF('Analytical Report'[CreditInvoice] = True,

 IF('Analytical Report'[Quantity] < 0, - 'Analytical Report'[Quantity]),

    IF('Analytical Report'[CreditInvoice] = True,

        IF('Analytical Report'[Quantity] > 0, 'Analytical Report'[Quantity]),

            IF('Analytical Report'[CreditInvoice] = False, 'Analytical Report'[Quantity])))

 

Thanks in advance!

1 ACCEPTED SOLUTION
harshnathani
Community Champion
Community Champion

@RickPowerBI ,

 

 

IF Column =
SWITCH (
    'Analytical Report'[CreditInvoice]
        TRUE (),
    'Analytical Report'[Quantity] < 0, - ( 'Analytical Report'[Quantity] ),
    'Analytical Report'[Quantity] > 0, ( 'Analytical Report'[Quantity] ),
    'Analytical Report'[Quantity]
)

 

 

1.jpg

 

 

Regards,

Harsh Nathani

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

View solution in original post

3 REPLIES 3
Greg_Deckler
Community Champion
Community Champion

Sorry @RickPowerBI but I am not exactly following this. I will recommend that you use a SWITCH(TRUE()...) statement versus nested IF statements, much cleaner and easier to follow the logic. 



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...
harshnathani
Community Champion
Community Champion

@RickPowerBI ,

 

 

IF Column =
SWITCH (
    'Analytical Report'[CreditInvoice]
        TRUE (),
    'Analytical Report'[Quantity] < 0, - ( 'Analytical Report'[Quantity] ),
    'Analytical Report'[Quantity] > 0, ( 'Analytical Report'[Quantity] ),
    'Analytical Report'[Quantity]
)

 

 

1.jpg

 

 

Regards,

Harsh Nathani

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

Thank you very much, using SWITCH is much easier than what I was trying.

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.