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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
ianneg77
Frequent Visitor

If statement involving subtraction. From Excel to BI.

I am looking to recreate an if statement from Excel in Power BI. But it is more than a simple If statement where I could just use a conditional column in BI. Maybe I am over-complicating it but I wanted to see if someone could point me in the right direction.

if statement for BI.JPG

1 ACCEPTED SOLUTION
v-ljerr-msft
Microsoft Employee
Microsoft Employee

Hi @ianneg77,

 

If I understand you correctly, you should be able to use the formula below to create a new calculate column in your table to get the same result in Power BI. Smiley Happy

Column =
IF (
    'Table1'[Request Date] - 'Table1'[Order Date]
        > 2,
    'Table1'[Ship Date] - 'Table1'[Request Date],
    'Table1'[Ship Date]
        - ( 'Table1'[Order Date] = 2 )
)

Note: You'll need to replace 'Table1' with your real table name.

 

c0.PNG

 

Regards

View solution in original post

3 REPLIES 3
v-ljerr-msft
Microsoft Employee
Microsoft Employee

Hi @ianneg77,

 

If I understand you correctly, you should be able to use the formula below to create a new calculate column in your table to get the same result in Power BI. Smiley Happy

Column =
IF (
    'Table1'[Request Date] - 'Table1'[Order Date]
        > 2,
    'Table1'[Ship Date] - 'Table1'[Request Date],
    'Table1'[Ship Date]
        - ( 'Table1'[Order Date] = 2 )
)

Note: You'll need to replace 'Table1' with your real table name.

 

c0.PNG

 

Regards

Excellent, that works! I was messing up the syntax when attempting. Thank you. 

ricardocamargos
Continued Contributor
Continued Contributor

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.

Users online (5,603)