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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Rolling Date

I am trying to create a measure that will use data only from last 30 days, but have not been able to get the correct syntax for my expression:

SUM(aggr(IF(floor([completed_date.autoCalendar.Date])>=num(today())-30 and floor([completed_date.autoCalendar.Date])<= num(today()),[completed_date.autoCalendar.Date],null()), SUM(aggr(sum({$<order_type={'sales'}>}distinct quantity), order_product_id))))

Any help to modify this expression?  Thanks in advance.

1 Solution

Accepted Solutions
BalaBhaskar_Qlik
Master
Master

May be this:

=SUM(Aggr(Sum(Distinct {$<Order_type={'sales'}, [completed_date.autoCalendar.Date] = {">=$(=Date(max([completed_date.autoCalendar.Date])-30))"}>}Quantity), order_product_id))))

View solution in original post

5 Replies
ValeriyaBartosh
Partner - Contributor III
Partner - Contributor III

Hello, may be try to use set analysis  https://help.qlik.com/en-US/sense/June2018/Subsystems/Hub/Content/ChartFunctions/SetAnalysis/set-ana...

sum ( {<Date={">=$(=MonthStart(Today(2),0)) <=$(=MonthEnd(Today(2),0))"},Year =,Month=,Week=> } Something)
sum ( {<Date={">=$(=Date(Today(2)-30)) <=$(=Date(Today(2)-1))"},Year =,Month=,Week=> } Something)

BalaBhaskar_Qlik
Master
Master

Try this:

=SUM(Aggr(Sum(Distinct {$<Order_type={'sales'}, [completed_date.autoCalendar.Date] =

{">=$(=Date(max([completed_date.autoCalendar.Date])-30, 'DD/MM/YYYY'))"}>}Quantity), order_product_id))))

BalaBhaskar_Qlik
Master
Master

May be this:

=SUM(Aggr(Sum(Distinct {$<Order_type={'sales'}, [completed_date.autoCalendar.Date] = {">=$(=Date(max([completed_date.autoCalendar.Date])-30))"}>}Quantity), order_product_id))))

Anonymous
Not applicable
Author

Thank you!!  This worked in applying rolling date to measure.

BalaBhaskar_Qlik
Master
Master

Thank you.