Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more
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:
| Legs | Job Number | Departure | Arrival | New column |
| 1 | S001 | 10/3/2022 | 6/3/2022 | TRUE |
| 2 | S001 | 7/3/2022 | 10/3/2022 | |
| 3 | S001 | 18/3/2022 | 15/3/2022 | |
| 4 | S001 | 15/3/2022 | 17/3/2022 | |
| 1 | S002 | 1/4/2022 | 8/4/2022 | FALSE |
| 2 | S002 | 9/4/2022 | 11/4/2022 |
Thanks for your help!
Solved! Go to Solution.
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:-
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
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:-
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
@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
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the October 2025 Power BI update to learn about new features.