Forum Discussion
ola7mat
8 years agoFrequent Visitor
OR statements
Appreciate if anyone can advise if there is an easier way to write this in power query? if [Colour] = "Red" or [Colour] = "blue" then true else false I.e. how or can I write something like so ...
- 8 years ago
Hello ola7mat,
Using https://www.powerquery.training/portfolio/replicate-power-pivots-switch-function/ as a guide:
(input) => let values = { { "Blue", true }, { "Red", true }, { input, false } }, Result = List.First ( List.Select ( values, each _{ 0 } = input ) ) { 1 } in ResultAdd Custom Column:
= fnSwitch ( [Colours] )
Yields the following result:
- 8 years ago
The function allows you not to have to rewrite the many formula's. Define it once and call it as necessary. Possibly share some more details about the data and your desired output(s).
ChrisMendoza
8 years agoResident Rockstar
The function allows you not to have to rewrite the many formula's. Define it once and call it as necessary. Possibly share some more details about the data and your desired output(s).
ola7mat
8 years agoFrequent Visitor
thanks for this, have finally got my head round the swtich function very useful.
appreciate the help very much!