Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
beck_bakytbek
Master
Master

compare the variables

Hi Folks,

i got a situation, for instance: my data-area does look like:

Project,Type, Turnover, Cost

1, A, 75, 90

2, B, 75, 78

3, C, 36, 35

i created 2 Variables:

Sum({<Typ = {'*'}>}Turnover) and Sum({<Typ = {'*'}>}Turnover) i want to compare 2 Variables, if my Turnover is lower than my Cost, then the Cost need to be taken

expected output is:

Project,     Type,      Turnover,          Cost,   Compare Ratio

1,                A,           75,                90,          90

2,                B,           75,                78,          78

3,                C,           36,                35,          36

--------------------------------------------------------------------------

                                 186                203         204


does any body have any idea ?

Thanks a lot

Beck

1 Solution

Accepted Solutions
sunny_talwar

This will work on row level... but to get the right total also, you might need to use Sum(Aggr())...

Sum(Aggr(RangeMax($(vTurnover),$(vCost)), Project))

View solution in original post

8 Replies
Anonymous
Not applicable

This can be done using if expression also,

if(Turnover>Cost,Turnover,Cost) as new_field.

In case you can use other than variables.

sunny_talwar

May be this

Sum({<Type = {"*"}>} RangeMax(Turnover, Cost))

beck_bakytbek
Master
Master
Author

Hi Sunny,

thanks a lot for your feedback and help,

This was my first option as well, i want ask you, can i compare this way 2 Variables ?

Thanks a lot

Beck

beck_bakytbek
Master
Master
Author

Hi aparna,

thanks a lot for your feeback, but this the wrong way, if i use 'if then', so my total sum has a deviation in total.

Beck

sunny_talwar

can i compare this way 2 Variables ?

Not sure I understand what this means?

beck_bakytbek
Master
Master
Author

Sunny : this way: Sum({<Typ = {'*'}>} RangeMax(Turnover,Cost)) is cool.

but i created 2 Variables:

Sum({<Typ = {'*'}>}Turnover) = vTurnover

Sum({<Typ = {'*'}>}Cost) = vCost

Can i compare those variables ? Can i make that so: Sum({<Typ = {'*'}>} RangeMax($(vTurnover),$(vCost))) ?

thanks a lot

Beck

sunny_talwar

This will work on row level... but to get the right total also, you might need to use Sum(Aggr())...

Sum(Aggr(RangeMax($(vTurnover),$(vCost)), Project))

beck_bakytbek
Master
Master
Author

Thanks a lot Sunny for your help and feedback.

it does work