Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I need to create a dynamic date range for set analysis
Sum({<$(vClearPeriods),Date_Num = {$(vCurrentPeriodSelected)}>}[Quantity KPI])
where vCurrentPeriodSelected is defined like that:
=If($(vDateButtonSelected)=1,
">=$(=Min(Date_Num))<=$(=Max(Date_Num))"
,
">=$(=Num(YearStart(Max(Date_Num))))<=$(=Max(Date_Num))"
Another words, I want final date string to be included in the expression.
Unfortunately, I receive an empty string:
Help would be much appreciated...
Correcting some syntax error in above comment
Var1 =If('$(vDateButtonSelected)=1','$(varOption1)','$(varOption2)')
varOption1 ='">=$(=Min(Date_Num))<=$(=Max(Date_Num))"'
varOption2 ='">=$(=Num(YearStart(Max(Date_Num))))<=$(=Max(Date_Num))"'
Sum({<$(vClearPeriods),Date_Num = {$(Var1)}>}[Quantity KPI])
You can create three variables like below
Var1 =If('$(vDateButtonSelected)=1',$(varOption1)','$(varOption2)
And then in your expression use $(var1) this
Correcting some syntax error in above comment
Var1 =If('$(vDateButtonSelected)=1','$(varOption1)','$(varOption2)')
varOption1 ='">=$(=Min(Date_Num))<=$(=Max(Date_Num))"'
varOption2 ='">=$(=Num(YearStart(Max(Date_Num))))<=$(=Max(Date_Num))"'
Sum({<$(vClearPeriods),Date_Num = {$(Var1)}>}[Quantity KPI])
Hi @nimishpgupta,
I updated the expression based on what you suggested, but without adding variables.
Just added the char ' as you did, and now it works!
=If('$(vDateButtonSelected)=1',
'">=$(=Min(Date_Num))<=$(=Max(Date_Num))"'
,
'">=$(=Num(YearStart(Max(Date_Num))))<=$(=Max(Date_Num))"'
)
Thanks for your help!