Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
RanMH
Contributor III
Contributor III

Depending on the cycle selection i will define a calculation

Hello,

 

I need to read the selection of the user in the chart cycle(day,week,Month)

I have columns flags i want to do the sum of a parameter X  where flag= 1

I have flag_ endweek, flag endmonth, flag end year....

I used this variable 

 

 v_set_flags=if(getcurrentfield(Time_Scale)='CAL.YEARWEEKNUM','flag_week={"1"}',
if(getcurrentfield(Time_Scale)='CAL.YEAR','Flag_yearEnd={"1"}',
if(getcurrentfield(Time_Scale)='CAL.QUARTER','Flag_QuarterEnd={"1"}',
if(getcurrentfield(Time_Scale)='CAL.YEARMONTH','Flag_Month={"1"}', 'CAL.K_DATE*={"*"}'


))))

 

Then i defined a set analysis for the chart:

sum({<"$( v_set_flags)"> } ParamaterX)

Mu purpose is for example user select Week-----> Do the sum  of parameterX where flagweek=1 

if selction Month---> Do sum of parametrX where flagMonth=1.........

It gives me very high values and wrong calculation can you please help me to solve this issue ?

 

 

 

6 Replies
MayilVahanan

Hi

Remove the double quotes in ur set analysis & try it.

sum({<$( v_set_flags)> } ParamaterX)

And also, hope your variable has equal sign like below

MayilVahanan_0-1627465023197.png

 

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
RanMH
Contributor III
Contributor III
Author

I tryed that aleady it's not working the calculation always wrong 

Yes ia have equal sigh

MayilVahanan

Hi,

Its working fine for me.

Can you send the sample file to debug in detail?

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
RanMH
Contributor III
Contributor III
Author

Hello,

here you have an example with one parameter, and the data is like that shape 

I have column flags and i want to calculate only where flags=1 depending on the cycle selection(Week,Month...)

you have the variable and the code used, my problem is that it works but results are false 

RaniaMH_0-1627474298123.png

 

MayilVahanan

Hi 

PFA

Based on ur sample, its "Time" . 

MayilVahanan_0-1627523407938.png

 

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
RanMH
Contributor III
Contributor III
Author

Hello,

 

Actually yes it works but in stead of taking only the values for the end of the week for example it takes the sum of all the values of the previous week until this week.

Which is False i want to calculate the sum of the end of each week only for this week.

it takes all the flags_week=1 and sum them 

since i want to take for example for week 31 , the sum of values at the end of this week only flags=1 for this periode not to sum with the pervious periode