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

Level up your Power BI skills this month - build one visual each week and tell better stories with data! Get started

Reply
Ericwhv
Helper II
Helper II

DAX - Measurement support

Hi All

 

Thank you everyone!

Last time, I asked to build a measurment about how to check the "Last Leg"

Pervoius Question

 

Now, i am not sure if anyone could help me to build a measurement to define the shipment delivered or not?

 

Backgroud:

if GNR origin = left(Consol Lane,3), that is "First Leg"

if GNR Dest = Right(Consol Lane,3), that is the "Last Leg"

the rest should define as "Transit Leg"

Assume every shipment should has a "Last Leg"

HB is the number to define / group the shipment together.

 

Requirment:

if the shipment missing last leg, the result will need to show "Not Arrive, missing last leg"

if the shipment has a last leg, and there are no arrival date on the last leg, the result will need to show "Not Arrive"

if the shipment has a last leg, and arrive date is there, the result will be "Arrived"

 

HBICConsol LaneMovement LaneGNR OrignGNR DestArrival dateLeg CheckResult
H4805777AMS1234AMS-FRAAMS-BUHAMSBUH01-AugFirst LegNot arrive
H4805777BUD4567BUD-BUHAMS-BUHAMSBUH Last LegNot arrive
H4805777FRA5678FRA-BUDAMS-BUHAMSBUH03-AugTransit LegNot arrive
H4805792AMS9999AMS-FRAAMS-BUHAMSBUH02-AugFirst LegNot Arrive, Missing last leg
H4805792FRA8888FRA-BUDAMS-BUHAMSBUH Transit LegNot Arrive, Missing last leg
H55778AMS5555AMS-FRAAMS-BUHAMSBUH03-AugFirst LegArrived
H55778FRA6666FRA-BUDAMS-BUHAMSBUH04-AugTransit LegArrived
H55778BUD7777BUD-BUHAMS-BUHAMSBUH05-AugLast LegArrived

 

Thank you every one!!!

1 ACCEPTED SOLUTION
Fowmy
Super User
Super User

@Ericwhv 
I added two columns, one calculate the Leg Check and the 2nd for the  result

Leg Check = 
SWITCH(
    TRUE(),
    LEFT(Table6[Consol Lane],3) = Table6[GNR Orign] , "First Leg",
    RIGHT(Table6[Consol Lane],3) = Table6[GNR Dest] , "Last Leg",
    "Transit Leg"
)
Check = 
VAR __LegCheck = Table6[Leg Check]
VAR __HB = Table6[HB]
VAR __T1 = FILTER( Table6, Table6[Leg Check] = "Last Leg" && Table6[HB] = __HB)
VAR __T2 = FILTER( Table6, Table6[Leg Check] = "Last Leg" && Table6[Arrival date]=BLANK() && Table6[HB] = __HB)
VAR __T3 = FILTER( Table6, Table6[Leg Check] = "Last Leg" && Table6[Arrival date]<>BLANK() && Table6[HB] = __HB)
RETURN
    SWITCH(
        TRUE(),
        ISEMPTY(__T1), "Not Arrived, Missing last leg",
        NOT ISEMPTY(__T2), "Not Arrived",
        NOT ISEMPTY(__T3), "Arrived"        
)


Result

Fowmy_0-1661081250589.png

 










Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

View solution in original post

3 REPLIES 3
Fowmy
Super User
Super User

@Ericwhv 
I added two columns, one calculate the Leg Check and the 2nd for the  result

Leg Check = 
SWITCH(
    TRUE(),
    LEFT(Table6[Consol Lane],3) = Table6[GNR Orign] , "First Leg",
    RIGHT(Table6[Consol Lane],3) = Table6[GNR Dest] , "Last Leg",
    "Transit Leg"
)
Check = 
VAR __LegCheck = Table6[Leg Check]
VAR __HB = Table6[HB]
VAR __T1 = FILTER( Table6, Table6[Leg Check] = "Last Leg" && Table6[HB] = __HB)
VAR __T2 = FILTER( Table6, Table6[Leg Check] = "Last Leg" && Table6[Arrival date]=BLANK() && Table6[HB] = __HB)
VAR __T3 = FILTER( Table6, Table6[Leg Check] = "Last Leg" && Table6[Arrival date]<>BLANK() && Table6[HB] = __HB)
RETURN
    SWITCH(
        TRUE(),
        ISEMPTY(__T1), "Not Arrived, Missing last leg",
        NOT ISEMPTY(__T2), "Not Arrived",
        NOT ISEMPTY(__T3), "Arrived"        
)


Result

Fowmy_0-1661081250589.png

 










Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Hi @Fowmy 

not sure if you could help me?
the above quesiton, what if i add one more status?
If the shipment is not "Last Leg" AND the "Delivery date" is there
then, the status need to show "Not Arrived - DLV presented"

Thank you for your help!!

Hi Fowmy!
It is work, thank you so much!!

appreciate for your help 🙂

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

Check out the April 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.