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

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.

Reply
nirrobi
Helper V
Helper V

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
1 ACCEPTED SOLUTION

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.

 

 

View solution in original post

2 REPLIES 2
v-chuncz-msft
Community Support
Community Support

@nirrobi,

 

You may try to use RANKX Function and SUMX Function.

Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

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.

 

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.