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
Anonymous
Not applicable

multiple ifs

Hi, i have multiple conditions, how is this doable in power bi?

 

IF
([SCHEDULE_SHIP_DATE] < TODAY() OR [SCHEDULE_SHIP_DATE] < TODAY() + 2)

THEN 'Today'

 

ELSEIF ([SCHEDULE_SHIP_DATE] < TODAY() OR
            [SCHEDULE_SHIP_DATE] < TODAY() + 2 OR
            [SCHEDULE_SHIP_DATE] < TODAY() + 6)

 

THEN 'N5D'

 

ELSEIF ([SCHEDULE_SHIP_DATE] < TODAY() + 13)

 

THEN 'N2W'

 

END

4 REPLIES 4
Anonymous
Not applicable

Hi @Anonymous ,

 

You could try SWITCH() function.

https://docs.microsoft.com/en-us/dax/switch-function-dax 

However, the second condition look wired.

([SCHEDULE_SHIP_DATE] < TODAY() OR [SCHEDULE_SHIP_DATE] < TODAY() + 2) could be both "Today" and "N5D"?

 

Best Regards,

Jay

Samarth_18
Community Champion
Community Champion

Hi @Anonymous ,

 

You can use below code:-

 

column =
IF (
    OR ( [SCHEDULE_SHIP_DATE] < TODAY (), [SCHEDULE_SHIP_DATE] < TODAY () + 2 ),
    "Today",
    IF (
        OR (
            [SCHEDULE_SHIP_DATE] < TODAY (),
            OR (
                [SCHEDULE_SHIP_DATE]
                    < ( TODAY () + 2 ),
                [SCHEDULE_SHIP_DATE]
                    < ( TODAY () + 6 )
            )
        ),
        "N5D",
        IF ( [SCHEDULE_SHIP_DATE] < ( TODAY () + 13 ), "N2W" )
    )
)

 

 

Thanks,

Samarth

Best Regards,
Samarth

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
Connect on Linkedin

Anonymous
Not applicable

hi @Samarth_18 the formula you suggested seems to not be working on the output i desire.

 

this formula:

SSD = IF(
    'Open Orders_BOM'[SCHEDULE_SHIP_DATE] < TODAY(),
    "Backlog",
    IF('Open Orders_BOM'[SCHEDULE_SHIP_DATE] < TODAY() + 2,
    "Today",

 

    IF('Open Orders_BOM'[SCHEDULE_SHIP_DATE]< TODAY() + 6,
    "N5D",
    "Future"
)))
 

 is actually the reference to be used, i want to modify that formula into a new classification:

 

New Column (DESIRED OUTPUT):


N5D will cover all "Backlog" , "N5D", "Today"
Today will cover "Backlog","Today"
Future will be "N2W"

 

 

For your first condition i.e. N5D will cover all "Backlog" , "N5D", "Today", if SSD = N5D then  it will show N5D but it will show N5D for backlog and today as well since we have applied OR condition. N5D and Today cant go in parellel in such case. Could you please check if we are missing any other condition?

 

Best Regards,
Samarth

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
Connect on Linkedin

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.