Forum Discussion
ruthgammack
4 years agoFrequent Visitor
switch statement using text and a number column
Trying the below when the kms are 0 it still will return a 0 and not 20. Is there a way i can use the below with some minor changes?? Buffer Kms = SWITCH(TRUE(), ('Co-ordinate'[Mode] = "Air") ...
- 4 years ago
Hi ruthgammack
Try this:
Buffer Kms = IF ( 'Co-ordinate'[Kms] = 0, 20, SWITCH ( TRUE (), ( 'Co-ordinate'[Mode] = "Air" ), 'Co-ordinate'[Kms] / 100 * 22, ( 'Co-ordinate'[Mode] = "Sea" ), 'Co-ordinate'[Kms] / 100 * 24, ( 'Co-ordinate'[Mode] = "Roa" ), 'Co-ordinate'[Kms] / 100 * 18, ( 'Co-ordinate'[Mode] = "Rai" ), 'Co-ordinate'[Kms] / 100 * 9, ( 'Co-ordinate'[Mode] = "Cou" ), 'Co-ordinate'[Kms] / 100 * 22 ) )If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos✌️!!
VahidDM
4 years agoSuper User
Hi ruthgammack
Try this:
Buffer Kms =
IF (
'Co-ordinate'[Kms] = 0,
20,
SWITCH (
TRUE (),
( 'Co-ordinate'[Mode] = "Air" ),
'Co-ordinate'[Kms] / 100 * 22,
( 'Co-ordinate'[Mode] = "Sea" ),
'Co-ordinate'[Kms] / 100 * 24,
( 'Co-ordinate'[Mode] = "Roa" ),
'Co-ordinate'[Kms] / 100 * 18,
( 'Co-ordinate'[Mode] = "Rai" ),
'Co-ordinate'[Kms] / 100 * 9,
( 'Co-ordinate'[Mode] = "Cou" ),
'Co-ordinate'[Kms] / 100 * 22
)
)
If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos✌️!!
ruthgammack
4 years agoFrequent Visitor
unfortunately it doesnt work. ill keep trying