Forum Discussion
IF or SWITCH multiple values not getting syntax right
BartVlek , a New column like
Switch ( true(),
[supplier] = "COCACOLA" && [SHOP] = "AMSTERDAM" , 65.00,
[supplier] = "PEPSICOLA" && [SHOP] = "ROTTERDAM" , 60.00,
[SUPDISC]
)
Same can be done with IF
- BartVlek6 years agoHelper II
Thank you !! And what does it look like when the name of the new column should be SUPDISCDEF?
- amitchandak6 years agoSuper User
BartVlek , not sure what you mean by that. A new column like
SUPDISCDEF =
Switch ( true(),
[supplier] = "COCACOLA" && [SHOP] = "AMSTERDAM" , 65.00,
[supplier] = "PEPSICOLA" && [SHOP] = "ROTTERDAM" , 60.00,
[SUPDISC]
)- BartVlek6 years agoHelper II
I transformed your suggestion to the actual situation. The shop doesn't have a name, but a number as you can see.
When I then copy-paste it to PBI-desktop and run, I receive a syntaxis error. What can it be? Do I not need to add the name of the table?
LEVKORTDEF =
SWITCH (
TRUE (),
[LEVERANCIER] = "ALDIPRESS"
&& [FIL] = "1", 65.00,
[LEVERANCIER] = "BETAPRESS"
&& [FIL] = "1", 60.00,
[LEVKORTING]
)