Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
In Qlik Sense, I have a table PlanningItems. The unique Id here is under PlanningItem-Id. Here is a time schedule for each Account-Id with a PlanningItems.StartDate and PlanningItems.EndDate. Per Order-Id, it indicates, whether it is a PlanningItems.TravelDaysStart where 1 is a yes, and whether it is a PlanningItems.TravelDaysEnd, where 1 is a yes. Now I need to create a count of the Traveldays per Order-Id, at the Account-Id level, which works, however, the problem is in the following. If a PlanningItems.EndDate connects to a PlanningItems.StartDate if the Account-Id is the same and an Order-Id is entered, this should be seen as 1 travelday, not two. How to make this!
Below the data and TravelDays now, and what i need/expect:
[PlanningItem-id] | [Account-id] | [Order-id] | [PlanningItems.TravelDaysStart] | [PlanningItems.StartDate] | [PlanningItems.TravelDaysEnd] | [PlanningItems.EndDate] | TravelDays Now | TravelDays Expected |
5066549580813093 | 36591746972387589 | 0 | 01-07-2023 | 0 | 02-07-2023 | |||
5066549580813145 | 36591746972387589 | 0 | 04-07-2023 | 0 | 07-07-2023 | |||
5066549580812222 | 36591746972387589 | 12384898975281979 | 1 | 09-07-2023 | 1 | 23-07-2023 | 2 | 2 |
5066549580813303 | 36591746972387589 | 12384898975281439 | 1 | 24-07-2023 | 1 | 30-07-2023 | 2 | 1 |
5066549580813065 | 36591746972387589 | 0 | 31-07-2023 | 0 | 31-07-2023 | |||
5066549580813334 | 36591746972387589 | 0 | 02-08-2023 | 0 | 02-08-2023 | |||
5066549580813570 | 36591746972387589 | 0 | 03-08-2023 | 0 | 03-08-2023 | |||
5066549580813308 | 36591746972387589 | 12384898975282538 | 0 | 05-08-2023 | 0 | 06-08-2023 | ||
5066549580813518 | 36591746972387589 | 0 | 08-08-2023 | 0 | 08-08-2023 | |||
5066549580813475 | 36591746972387589 | 12384898975281936 | 1 | 09-08-2023 | 1 | 14-08-2023 | 2 | 2 |
5066549580813743 | 36591746972387589 | 0 | 15-08-2023 | 0 | 15-08-2023 | |||
5066549580813736 | 36591746972387589 | 0 | 16-08-2023 | 0 | 18-08-2023 | |||
5066549580813180 | 36591746972387589 | 0 | 19-08-2023 | 0 | 03-09-2023 | |||
Total | 6 | 5 |
Hi @Sebaas ,
Can you please share the calculation used for expected Travel Days.
and one more thing Both start date and end date are in same table right Planningitem table , but you used connects in your question, it seems that two dates are in different tables?
Please clarify
Dear RamanaKumarChin
The Data is in the same table, PlanningItems, sorry for the inconvenience.
The TravelDays Now, is just a count of the columns PlanningItems.TravelDaysStart and PlanningItems.TravelDaysEnd.
TravelDays Expected isn't a calculation, it's just the outcome I need.
The problem is, is that now, for 23/07/2023 and 24/07/2024 two days are calculated as TravelDay. However, it is a consecutive date, because one travels from one order to another, so it should be considered as 1 travel day..
For Order 12384898975281936, two travel days is correct, because there is no consecutive order date from another order. I hope this makes things clear!