Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Posting on Qlik Community is temporarily paused for some users. Thank you for patience and we'll update you soon!
cancel
Showing results for 
Search instead for 
Did you mean: 
SheerazShah
Contributor
Contributor

Calculating sum using set analysis based on condition

I am using the following expression to get the sum of quantity on particular date.

=Sum({< DOC_DATE = ${ date( MAX_DATE ) } >} SECONDARY_QTY2)

But what set expression is doing is something like

=sum(SECONDARY_QTY2)

its not evaluating the condition I have given and get the overall sum of "SECONDARY_QTY2". Where as when I am using the below expression it is giving me the sum after evaluating the condition.

Sum( {< DOC_DATE ={ '8/5/2020'} >} SECONDARY_QTY2)

The above statement is working fine as per my requirement but I want the day dynamic based on the user selection.

Kindly guide me how can I fix this issue.

Thank in Advance.

 

Regards,

Sheeraz

 

 

Labels (1)
2 Replies
jwjackso
Specialist III
Specialist III

Try

=Sum({< DOC_DATE = {" =$(=date( MAX_DATE ))" } >} SECONDARY_QTY2)

Kushal_Chawda
MVP
MVP

What is MAX_DATE? Is it variable or Field? 

If it is variable use below.  Note: Provide Date format in variable itself

=Sum({< DOC_DATE = {"$(MAX_DATE )"} >} SECONDARY_QTY2)

If it is field then use below

=Sum({< DOC_DATE = {"$(=date(max(MAX_DATE )))"} >} SECONDARY_QTY2)