It is currently November 29th, 2021, 6:33 am

Can I use a calc formula to change many values in a measure?

Help with creating, editing & fixing problems with skins
Sunspot2
Posts: 46
Joined: January 29th, 2010, 3:39 pm

Can I use a calc formula to change many values in a measure?

Post by Sunspot2 »

Ok, here I am again bothering you guys.

This time my question is:
I know we can use a formula -- like Formula=(MeasureX=0?(-1):MeasureX) to change the value 0 of that measure to -1
But, can I use a formula to change many values?
Like change 0 for -1, 10 for -2, 20 for -3 and so on.
User avatar
kenz0
Developer
Posts: 263
Joined: July 31st, 2009, 2:23 pm
Location: Tokyo, JPN

Re: Can I use a calc formula to change many values in a measure?

Post by kenz0 »

Basically, you need multiple formula for multiple condition. But you can put in conditional operator further into the true or false expression.
For example, it is assumed that you need the following 3 conditions.
  • ( MeasureX = 0 ? -1 : MeasureX )
  • ( MeasureX = 10 ? -2 : MeasureX )
  • ( MeasureX = 20 ? -3 : MeasureX )
These conditions can be integrated into one conditional operator.
(If the value is 0, -1 is returned. If the value is 10, -2 is returned. If the value is 20, -3 is returned. And if else, MeasureX is returned.)
  • ( MeasureX = 0 ? -1 : ( MeasureX = 10 ? -2 : ( MeasureX = 20 ? -3 : MeasureX ) ) )
Note that as for the nest of conditional, 9 sets are limits.
.
Image
Sunspot2
Posts: 46
Joined: January 29th, 2010, 3:39 pm

Re: Can I use a calc formula to change many values in a measure?

Post by Sunspot2 »

Nice!
Thanks a lot!
Sunspot2
Posts: 46
Joined: January 29th, 2010, 3:39 pm

Re: Can I use a calc formula to change many values in a measure?

Post by Sunspot2 »

Like this?

(MeasureX=0?350:(MeasureX=10?350:(MeasureX=20?-2:(MeasureX=30?-2:(MeasureX=40?-3:(MeasureX=50?-3:(MeasureX=60?-4:(MeasureX=70?-4:(MeasureX=80?-5:MeasureX)))))))))

Or I can add 1 more subset?
User avatar
kenz0
Developer
Posts: 263
Joined: July 31st, 2009, 2:23 pm
Location: Tokyo, JPN

Re: Can I use a calc formula to change many values in a measure?

Post by kenz0 »

You can add one more set. That's just a limit.
.
Image
Sunspot2
Posts: 46
Joined: January 29th, 2010, 3:39 pm

Re: Can I use a calc formula to change many values in a measure?

Post by Sunspot2 »

TY!