Forum Discussion
urgent help needed
- 1 year ago
Hi tkavitha911
Demurrage_Cost = SWITCH( TRUE(), 'Table'[Day_at_port] <= 'Table'[FREE days], 0, 'Table'[Markets] = "Australia", ('Table'[Day_at_port] - 7) * 50 * 'Table'[Count of Container Number], 'Table'[Markets] = "Korea", ('Table'[Day_at_port] - 7) * 24 * 'Table'[Count of Container Number], 'Table'[Markets] = "China", VAR ExtraDays = 'Table'[Day_at_port] - 14 VAR Charge = SWITCH( TRUE(), ExtraDays <= 4, 0, ExtraDays <= 12, (ExtraDays - 4) * 96, (8 * 96) + (ExtraDays - 12) * 125 ) RETURN Charge * 'Table'[Count of Container Number], 'Table'[Markets] = "Shenzhen", VAR ExtraDays = 'Table'[Day_at_port] - 14 VAR Charge = SWITCH( TRUE(), ExtraDays <= 4, 0, ExtraDays <= 12, (ExtraDays - 4) * 96, (8 * 96) + (ExtraDays - 12) * 125 ) RETURN Charge * 'Table'[Count of Container Number], BLANK() )The SWITCH(TRUE(), ...) structure allows for flexible multi-condition evaluation.
For each market, we calculate ExtraDays by subtracting the free threshold from Day_at_port.
Based on tiered rate structures, we apply the appropriate cost calculations and multiply by container count.
This formula assumes you're applying it in a table with fields like Markets, Day_at_port, FREE days, and Count of Container Number. Adjust field names if yours differ. You can convert this into a measure with additional aggregation (e.g., SUMX) if needed at the visual level.
Hi tkavitha911,
As we haven’t heard back from you, we would like to follow up to see if the solution provided by the super user resolved your issue. Please let us know if you need any further assistance.
If our super user response resolved your issue, please mark it as "Accept as solution" and click "Yes" if you found it helpful.
Regards,
Vinay Pabbu
- tkavitha9111 year ago
Helper III
Thank you for your suggestions. However, the calculation isn't working correctly. It needs to function within a loop.
- Anonymous1 year agoNot applicable
Hi tkavitha911,
Thanks techies for addressing the issue.As we haven’t heard back from you, we would like to follow up to see if the solution provided by the Super user resolved your issue. Please let us know if you need any further assistance.
If our super user response resolved your issue, please mark it as "Accept as solution" and click "Yes" if you found it helpful.Regards,
Vinay Pabbu- Anonymous1 year agoNot applicable
Hi @tkavitha911,
As we haven’t heard back from you, we would like to follow up to see if the solution provided by the Super user resolved your issue. Please let us know if you need any further assistance.
If our super user response resolved your issue, please mark it as "Accept as solution" and click "Yes" if you found it helpful.Regards,
Vinay Pabbu