urgent help for this dax
1 Topicurgent help needed
Hi Team I need your support in creating a DAX formula to calculate Demurrage Cost based on two tables, with the logic applied market-wise. Here's the requirement: For each record, if Day_at_port ≤ Free_days, then the Demurrage Cost = 0. If Day_at_port > Free_days, then we need to calculate the cost based on: The number of days exceeding the free period. The market-specific rate structure. For example: In Australia, the first 7 days are free. From the 8th day onward, each extra day is charged at a flat rate. In China, the first 14 days are free. After that: Days 15–18: No charge Days 19–26: Charged at $96 per container per day Days >26: Charged at $125 per container per day This logic should loop through the applicable ranges and apply the correct rate based on the number of days at port. Could you please help me write a DAX formula that handles this logic for each market? Thank you so much for your help! Markets FT (Days) Flat rate>FT 7-14 days 15-19 days 19-26 days >26 Australia 7 50 China 14 96 125 Korea 7 24 shenzhen 14 96 125 125 Markets Supply Category Max of ETA Count of Container Number Capacity Clearence days FREE days Demurrage_Days Predicted_Delivery_Date Day_at_port China 02 MTO 12-02-2025 00:00 49 8 3 14 16-02-2025 00:00 4 China 01 SMR 13-02-2025 00:00 7 8 3 14 17-02-2025 00:00 4 China 02 MTO 13-02-2025 00:00 3 8 3 14 17-02-2025 00:00 5 China 01 SMR 15-02-2025 00:00 17 8 3 14 19-02-2025 00:00 5 China 01 SMR 17-02-2025 00:00 2 8 3 14 20-02-2025 00:00 4 China 01 SMR 18-02-2025 00:00 1 8 3 14 21-02-2025 00:00 5 China 02 MTO 19-02-2025 00:00 1 8 3 14 22-02-2025 00:00 5 China 01 SMR 20-02-2025 00:00 40 8 3 14 24-02-2025 00:00 4 China 02 MTO 20-02-2025 00:00 6 8 3 14 24-02-2025 00:00 4 China 01 SMR 21-02-2025 00:00 3 8 3 14 24-02-2025 00:00 5 China 01 SMR 25-02-2025 00:00 1 8 3 14 28-02-2025 00:00 4 China 01 SMR 28-02-2025 00:00 7 8 3 14 04-03-2025 00:00 4 China 02 MTO 28-02-2025 00:00 2 8 3 14 04-03-2025 00:00 4 Australia 01 SMR 01-01-2025 00:00 1 6 3 7 04-01-2025 00:00 4 Australia 01 SMR 02-01-2025 00:00 64 6 3 7 06-01-2025 00:00 5 Australia 01 SMR 03-01-2025 00:00 1 6 3 7 06-01-2025 00:00 5 Australia 01 SMR 05-01-2025 00:00 2 6 3 7 08-01-2025 00:00 5 Australia 01 SMR 09-01-2025 00:00 2 6 3 7 12-01-2025 00:00 5 Australia 01 SMR 11-01-2025 00:00 35 6 3 7 15-01-2025 00:00 5 Australia 01 SMR 13-01-2025 00:00 3 6 3 7 16-01-2025 00:00 5 Australia 01 SMR 19-01-2025 00:00 2 6 3 7 22-01-2025 00:00 5 Australia 01 SMR 20-01-2025 00:00 1 6 3 7 23-01-2025 00:00 5 Australia 01 SMR 22-01-2025 00:00 1 6 3 7 25-01-2025 00:00 4 Australia 01 SMR 25-01-2025 00:00 6 6 3 7 29-01-2025 00:00 4 Australia 01 SMR 24-02-2025 00:00 1 6 3 7 27-02-2025 00:00 4 Australia 01 SMR 26-02-2025 00:00 3 6 3 7 01-03-2025 00:00 4 Australia 01 SMR 27-02-2025 00:00 2 6 3 7 02-03-2025 00:00 5 Australia 01 SMR 28-02-2025 00:00 1 6 3 7 03-03-2025 00:00 4 Korea 02 MTO 11-02-2025 00:00 5 10 3 7 14-02-2025 00:00 6 Korea 01 SMR 12-02-2025 00:00 10 10 3 7 16-02-2025 00:00 6 Korea 02 MTO 12-02-2025 00:00 16 10 3 7 16-02-2025 00:00 6 Korea 01 SMR 13-02-2025 00:00 3 10 3 7 17-02-2025 00:00 6 Korea 02 MTO 13-02-2025 00:00 10 10 3 7 17-02-2025 00:00 6 Korea 01 SMR 17-02-2025 00:00 3 10 3 7 20-02-2025 00:00 6 Korea 02 MTO 18-02-2025 00:00 1 10 3 7 21-02-2025 00:00 5 Korea 02 MTO 21-02-2025 00:00 5 10 3 7 24-02-2025 00:00 5 Korea 01 SMR 23-02-2025 00:00 5 10 3 7 26-02-2025 00:00 6 Korea 02 MTO 25-02-2025 00:00 5 10 3 7 28-02-2025 00:00 6 Korea 01 SMR 27-02-2025 00:00 1 10 3 7 02-03-2025 00:00 6 Korea 01 SMR 28-02-2025 00:00 3 10 3 7 03-03-2025 00:00 6 Shenzhen 01 SMR 07-01-2025 00:00 4 4 3 07-01-2025 00:00 4 Shenzhen 01 SMR 16-01-2025 00:00 1 4 3 16-01-2025 00:00 5 Shenzhen 01 SMR 17-01-2025 00:00 1 4 3 17-01-2025 00:00 4 Shenzhen 01 SMR 20-01-2025 00:00 2 4 3 20-01-2025 00:00 5 Shenzhen 01 SMR 26-01-2025 00:00 29 4 3 1 27-01-2025 00:00 5 Shenzhen 01 SMR 29-01-2025 00:00 5 4 3 1 30-01-2025 00:00 4 Shenzhen 01 SMR 30-01-2025 00:00 1 4 3 30-01-2025 00:00 5 Shenzhen 01 SMR 31-01-2025 00:00 1 4 3 31-01-2025 00:00 4 Shenzhen 01 SMR 04-02-2025 00:00 45 4 3 1 05-02-2025 00:00 5 Shenzhen 01 SMR 06-02-2025 00:00 1 4 3 06-02-2025 00:00 4 Shenzhen 01 SMR 08-02-2025 00:00 39 4 3 1 09-02-2025 00:00 5 Shenzhen 01 SMR 10-02-2025 00:00 10 4 3 1 11-02-2025 00:00 4 Shenzhen 01 SMR 19-02-2025 00:00 3 4 3 19-02-2025 00:00 4 Shenzhen 01 SMR 28-02-2025 00:00 13 4 3 1 01-03-2025 00:00 5Solved1.6KViews2likes9Comments