Forum Discussion
Anonymous
7 years agoNot applicable
Switch function between two values
I need to put some values into buckets. I believe the switch function is the way to go, but I'm not sure how it works when I need one of the criteria to fall in between two values. This is what I n...
- 7 years ago
Two possible ways to do this:
TIME AT FINAL = SWITCH ( TRUE (), 'QA'[AVG TIME AT DESTINATION] <75,"0-75", 'QA'[AVG TIME AT DESTINATION] >75 && 'QA'[AVG TIME AT DESTINATION]<105,"75-105" 'QA'[AVG TIME AT DESTINATION] >105,">105" ) or TIME AT FINAL = SWITCH ( TRUE (), 'QA'[AVG TIME AT DESTINATION] <75,"0-75", ''QA'[AVG TIME AT DESTINATION] >105,">105", "75-105" )
Greg_Deckler
7 years agoCommunity Champion
Two possible ways to do this:
TIME AT FINAL = SWITCH ( TRUE (), 'QA'[AVG TIME AT DESTINATION] <75,"0-75", 'QA'[AVG TIME AT DESTINATION] >75 && 'QA'[AVG TIME AT DESTINATION]<105,"75-105" 'QA'[AVG TIME AT DESTINATION] >105,">105" ) or TIME AT FINAL = SWITCH ( TRUE (), 'QA'[AVG TIME AT DESTINATION] <75,"0-75", ''QA'[AVG TIME AT DESTINATION] >105,">105", "75-105" )
Anonymous
7 years agoNot applicable
Nice, Greg_Deckler
For future reference, is the a reason that there needs to be two && in the formula? Does that have a meaning?
- Greg_Deckler7 years agoCommunity Champion
&& is your logical AND filter construct shorthand. A single & is concatenation. You could have used the AND function as well. || is OR.
- datamomgit5 years agoFrequent Visitor
I'd suggest you might want to assign a variable here.
TIME AT FINAL =
Var avgtime = QA[AVG TIME AT DESTINATION]
RETURN
SWITCH (
TRUE ()
, avgtime <75,"0-75"
, avgtime >105,">105"
, "75-105"
)