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! Learn more

Reply
NickProp28
Post Partisan
Post Partisan

How to add more conditions to the IF statement

Dear Community,

 

How can I add a condition to only show results for the MIN legs of each job number?

New column = IF(Checking[Departure]<= Checking[Arrival] , FALSE(),TRUE())

My expected outcome:

LegsJob NumberDepartureArrivalNew column
1S00110/3/20226/3/2022TRUE
2S0017/3/202210/3/2022 
3S00118/3/202215/3/2022 
4S00115/3/202217/3/2022 
1S0021/4/20228/4/2022FALSE
2S0029/4/202211/4/2022 

 

Thanks for your help!

 

1 ACCEPTED SOLUTION
Samarth_18
Community Champion
Community Champion

Hi @NickProp28 ,

 

You could try below code:-

 

New Column = 
VAR _min_leg =
    CALCULATE (
        MIN ( 'Table'[Legs] ),
        FILTER (
            ALL ( 'Table' ),
            'Table'[Job Number] = EARLIER ( 'Table'[Job Number] )
        )
    )
VAR _result2 =
    IF ('Table'[Departure] <= 'Table'[Arrival],"FALSE","TRUE")
RETURN
    IF( 'Table'[Legs] = _min_leg,_result2,BLANK())

 

Output:-

Samarth_18_0-1668765780856.png

 

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

View solution in original post

2 REPLIES 2
Samarth_18
Community Champion
Community Champion

Hi @NickProp28 ,

 

You could try below code:-

 

New Column = 
VAR _min_leg =
    CALCULATE (
        MIN ( 'Table'[Legs] ),
        FILTER (
            ALL ( 'Table' ),
            'Table'[Job Number] = EARLIER ( 'Table'[Job Number] )
        )
    )
VAR _result2 =
    IF ('Table'[Departure] <= 'Table'[Arrival],"FALSE","TRUE")
RETURN
    IF( 'Table'[Legs] = _min_leg,_result2,BLANK())

 

Output:-

Samarth_18_0-1668765780856.png

 

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

amitchandak
Super User
Super User

@NickProp28 , Try like

 

if( [Legs] = minx(filter(Table, [Job Number] = earlier([Job Number]) ), [Legs]) ,
IF(Checking[Departure]<= Checking[Arrival] , FALSE(),TRUE()), blank())

 

Power BI DAX- Earlier, I should have known Earlier: https://youtu.be/CVW6YwvHHi8

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
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!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

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