Forum Discussion

nirrobi's avatar
nirrobi
Icon for Helper V rankHelper V
8 years ago
Solved

Calculate Transit time between port destination

Hi all,

 

I have table with the following data:

 

Index - running number - no special purpose

LineDirection - the line route name

Port - one of the route direction

TransitTime - the time take to go from one port to the one ofter  - e.g. GRPIR to ILASH - 3 days

CumulativeTT - the cummulative time between different port - e.g. TRIST to ILASH - 7 days

 

I want the user to choose 3port e.g. ILASH and BRSSZ and SGSIN and the PBI should show 56 (32+24),

ILASH to SGSIN  = 32 - 0 = 32

SGSIN to BRSSZ = 33 - 9 = 24

 

the transhipment happen in SGSING

 

what is the right dax measure for this case?

hope I was clear.

thanks in advaced !!!

 

IndexLineDirectionPortTransitTimeCumulativeTT
1MD3_EILASH00
2MD3_EGRPIR33
3MD3_ETRIST47
4MD3_ETRALI310
5MD3_ETRMER313
6MD3_EEGSUZ215
7MD3_ESAJED318
8MD3_ESGSIN1432
9MD3_ETWKHH537
10MD3_EKRPUS441
11MD3_ECNSHA243
12MD3_ECNNGB245
13MD3_ECNYTN247
14SA3_WCNSHA00
15SA3_WCNNGB11
16SA3_WCNYTN34
17SA3_WHKHKG15
18SA3_WSGSIN49
19SA3_WBRIGI2332
20SA3_WBRSSZ133
21SA3_WBRPNG134
22SA3_WBRNVT236
23SA3_WUYMVD339
24SA3_WARBUE443
25SA3_WBRRIG245
  • nirrobi's avatar
    nirrobi
    8 years ago

    Thanks for your recommendation,

     

    I was able to solved the problem using the following DAX formula:

     

    Cumulative TT=
    CALCULATE(
        SUM( Table1[CummulativeTT] ) ,
        FILTER(
            ALL( Table1 ) ,
            Table1[Index] <= MAX( Table1[Index] )
            && Table1[LineDirection] = MAX( Table1[LineDirection] )
        )
    )

     

    The *MAGIC* for me wat the last line - where I can compare TEXT with the MAX function.

     

     

2 Replies

    • nirrobi's avatar
      nirrobi
      Icon for Helper V rankHelper V

      Thanks for your recommendation,

       

      I was able to solved the problem using the following DAX formula:

       

      Cumulative TT=
      CALCULATE(
          SUM( Table1[CummulativeTT] ) ,
          FILTER(
              ALL( Table1 ) ,
              Table1[Index] <= MAX( Table1[Index] )
              && Table1[LineDirection] = MAX( Table1[LineDirection] )
          )
      )

       

      The *MAGIC* for me wat the last line - where I can compare TEXT with the MAX function.