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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

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
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

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