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

Dynamic week expression

Hi,

I want to make an expression that every week change with the present week to make then a graph to compare the difference, I'm using this formula now:

(Count({<Semana={'W27'}>}ID_CASO))-(Count({<Semana={'W26'}>}ID_CASO))

I want the W27 and W26 to be dynamic, next week will be W28 and W27. I've tried a concat('W',week(today())) and the 'W' & week(today()) but all give an error.

How can I make this expression?

Thanks!

2 Replies
Kushal_Chawda

create two variable

vCurrentWeek = 'W'&week(today());

vPreviousWeek = 'W'&week(today())-1;

then expression like below

(Count({<Semana={'$(vCurrentWeek)'}>}ID_CASO))-(Count({<Semana={'$(vPreviousWeek)'}>}ID_CASO))

andreuares
Contributor
Contributor
Author

Thanks for your info, I had finally to generate 3 variables, because when I try to concatenate values it only generate a string without evaluating the formula, so I had to previously calculate the present week:

Let Week_num=Week(today());
Let vCurrentWeek = 'W' & Week_num;
Let vPreviousWeek = 'W' & (Week_num-1);