Forum Discussion
Calculating a revised plantID with SWITCH
- 1 year ago
Hi,
the issue pops up because of the parts List4260, List4790 in the switch statement. Note - both of them are lists, when the SWITCH statement is trying to compare [countrySubDivisionCode] (which is a single string) against your list table of values.
To fix this, you can try make the following change:
Calculated Plant = VAR List4260 = { "NB", "NL", "NS", "ON", "PE", "QC" } VAR List4790 = { "AB", "BC", "MB", "NT", "NU", "SK", "YT" } RETURN IF( OrderSlaLineItemDetail[countryCode] IN { "CA","US" }, SWITCH(TRUE(), OrderSlaLineItemDetail[countrySubDivisionCode] IN List4260, "4260", OrderSlaLineItemDetail[countrySubDivisionCode] IN List4790, "4790", OrderSlaLineItemDetail[plantId] ), OrderSlaLineItemDetail[plantId] )
Hi shadowsong42
Thank you for reaching out to the Microsoft Fabric Forum Community.
And also thanks to vicky_ for prompt and useful response.
Just following up to see if the solution provided was helpful in resolving your issue. Please feel free to let us know if you need any further assistance.
If the response addressed your query, kindly mark it as Accepted Solution and click Yes if you found it helpful this will benefit others in the community as well.
Best regards,
Prasanna Kumar