Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
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
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
115 | |
99 | |
86 | |
70 | |
62 |
User | Count |
---|---|
151 | |
120 | |
103 | |
87 | |
68 |