Skip to main content
Announcements
Qlik Connect 2025: 3 days of full immersion in data, analytics, and AI. May 13-15 | Orlando, FL: Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

between dates in variable set analysis

Hi

I have a calculation giving me a date range ' > =' & date (min (Date) ) & '< =' & date ( AddYears ( max ( date) , - 1 ) )

But when I define this calculation as a variable that does not work in the set analysis

= sum ( { <Date = { $ (variable) } >} [Ca CDE ] )

Can you help me?



Thank you

1 Solution

Accepted Solutions
lironbaram
Partner - Master III
Partner - Master III

why not use

sum ( { <Date = {"> =$(= date (min (Date) ) )  < =$(=date ( AddYears ( max ( date) , - 1 ) ))"} >} [Ca CDE ] )

View solution in original post

10 Replies
lironbaram
Partner - Master III
Partner - Master III

why not use

sum ( { <Date = {"> =$(= date (min (Date) ) )  < =$(=date ( AddYears ( max ( date) , - 1 ) ))"} >} [Ca CDE ] )

maxgro
MVP
MVP

this is my expression

sum({$ <d={"$(variable)"} >}  [Ca CDE ] )

and this variable (with equal sign), the date field is d I used to test it

= '>=' & date(min(d)) & '<=' & date ( AddYears ( max (d), -0 ) )

and it works

you have the field date and Date (Qlik is case sensitive!!!)



EDIT

attached an example


Anonymous
Not applicable
Author

hi,

Try

=Sum({<Date = {">=$(=Date(Min(Date))) <=$(=Date(Max(Date)-1))"}>}[Ca CDE ])

sasiparupudi1
Master III
Master III

Use it in double quotes

sum ( { <Date = { "$ (variable) "} >} [Ca CDE ] )


hth

sasi

engishfaque
Specialist III
Specialist III

Dear Saoud,

Please first check your variable value either it's coming in number format or date format. If it is coming in number format then please use Data function and convert into proper format.

However, please use single quotation and double quotation in against of Dollar sign expansion to check which one is working.

Kind regards,

Ishfaque Ahmed

jagan
Luminary Alumni
Luminary Alumni

Hi,

Instead of storing expression in single variable, create two variables with start and End dates like below and use those in Set analysis expression, this will make the expression meaningful to read and easily to understand and debug if there is any issue.

vStartDate = date (min (Date) )

vEndDate = date ( AddYears ( max ( date) , - 1 ) )

Variables in expressions:

= sum ( { <Date = { '>=$(=vStartDate)<=$(=vEndDate ) ' } >} [Ca CDE ] )


Hope this helps you.


Regards,

Jagan.

Anonymous
Not applicable
Author

Hi,

Thanks a lot it works

Anonymous
Not applicable
Author

perfect thanks

Anonymous
Not applicable
Author

Dear Ahmed,

Thank you for tour response it"s a good solution

best regards