Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.
Hi,
I have a huge table with transport data.
Route - is column with initial route
Desired output route - is column I would like to calculate which is next route taken by driver based on:
1. Filtering by registration plate (has to be exact same).
2. Dates - filter only loads taken within 2 days of previous unloading date.
Route | Loading date | Unloading date | Registration plate | Desired output date | Desired output Route |
Chicago - Ontario | 07-11-2019 | 08-11-2019 | 1ABC | no load taken | no load taken |
Atlanta - New York | 14-11-2019 | 15-11-2019 | 1ABC | 15-11-2019 | New York - Chicago |
New York - Chicago | 15-11-2019 | 18-11-2019 | 1ABC | 18-11-2019 | Chicago - Ontario |
Chicago - Ontario | 18-11-2019 | 19-11-2019 | 1ABC | 19-11-2019 | Los Angeles - New York |
Los Angeles - New York | 19-11-2019 | 20-11-2019 | 1ABC |
I tried below formula but it shows incorrect value:
Desired output date = CALCULATE(FIRSTNONBLANK(Table1[Loading date];1);FILTER(ALL(Table1);Table1[Loading date]<=[Unloading date]+2))
I would very much appreciate your help - I tried multiple lookup values and first non blank but have huge troubles with the syntax.
Solved! Go to Solution.
Hi @zuzaarbuza
See if the following DAX statement for calculated column works for:
Next route =
VAR RegistrationPlate = RouteTable[Registration plate]
VAR UnloadingDate = RouteTable[Unloading date]
RETURN
MAXX (
TOPN ( 1,
FILTER (
RouteTable,
RouteTable[Registration plate] = RegistrationPlate
&& RouteTable[Unloading date] > UnloadingDate
&& RouteTable[Loading date]
<= DATE ( YEAR ( UnloadingDate ), MONTH ( UnloadingDate ), DAY ( UnloadingDate ) + 2 )
),
RouteTable[Loading date], ASC
), RouteTable[Route]
)
Let us know if that was helpful.
Best
David
Hi @zuzaarbuza
See if the following DAX statement for calculated column works for:
Next route =
VAR RegistrationPlate = RouteTable[Registration plate]
VAR UnloadingDate = RouteTable[Unloading date]
RETURN
MAXX (
TOPN ( 1,
FILTER (
RouteTable,
RouteTable[Registration plate] = RegistrationPlate
&& RouteTable[Unloading date] > UnloadingDate
&& RouteTable[Loading date]
<= DATE ( YEAR ( UnloadingDate ), MONTH ( UnloadingDate ), DAY ( UnloadingDate ) + 2 )
),
RouteTable[Loading date], ASC
), RouteTable[Route]
)
Let us know if that was helpful.
Best
David
User | Count |
---|---|
119 | |
78 | |
59 | |
52 | |
48 |
User | Count |
---|---|
171 | |
117 | |
61 | |
59 | |
53 |