Skip to main content
Announcements
Accelerate Your Success: Fuel your data and AI journey with the right services, delivered by our experts. Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
DrMohAttya
Contributor II
Contributor II

update measure by changing input variable

Hi, Everyone

I try to use this equation to calculate the measure, using input variable .

Count({<[EventDTS] = {"=[EventDTS]>=$(Target_Period_Start) and [EventDTS] <= $(Target_Period_end)"},Source = {'OR'}>} distinct ID)

but when i change the variable value ($(Target_Period_end)), the measure didn't updated according to the variable 

is there any way to refresh or make the measure recalculate according to updated value ?

 

Labels (2)
5 Replies
paulcalvet
Partner - Specialist
Partner - Specialist

Hello,

I think there is an error in your set analysis :

instead of 

Count({<[EventDTS] = {"=[EventDTS]>=$(Target_Period_Start) and [EventDTS] <= $(Target_Period_end)"},Source = {'OR'}>} distinct ID)

You can try something like that (change the date format according to those in your application)

Count({<[EventDTS]= {">=$(=date(date#('$(Target_Period_Start)','DD/MM/YYYY')))<=$(=date(date#('$(Target_Period_end)','DD/MM/YYYY')))"},Source = {'OR'}>} distinct ID)

You can see in the editor your expression and then see how Qlik interpret your set analysis

paulcalvet_0-1700413753347.png

Regards,

 

 

 

 

 

DrMohAttya
Contributor II
Contributor II
Author

Thanks for your support

I tried your suggestion  but didn't give any result with me. as in attachement

2.jpg

as you see the variable didn't extracted in the equation.

while when I use my equation it extracted and give initial result, but when change the input variable didn't recalculated according to the new input.

1.jpg

example . when the initial target_period = 'Year' , it caculate the count of the past year and give 10000, then it should when change target_period to 'Month' , it should recalculate the count to give the count from the start of the year to the past month only and give result 6000. but the measure didn't changed and still give 10000.

 

Note: if i use KPI  card and add second KPIs as $(target_peroid_start) , it work normal and recalculate the measure in Frist KPI

Aasir
Creator III
Creator III

Sometimes you have to do refresh manually
Ctrl + Shift and R

paulcalvet
Partner - Specialist
Partner - Specialist

Ah ok, I see, in my example, I consider that Target_Period_Start is a date that you enter manually.

Can you try with $(=Target_Period_Start) ?

It should calculate the value of your variable and show iy in the expression evaluator.

DrMohAttya
Contributor II
Contributor II
Author

thanks for your help

I used other equation that give correct result with less time loading

count (distinct( if(EventDTS>=$(Target_Period_Start), if(EventDTS <= $(Target_Period_end),if(Source='OR', ID)))))