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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Measure - Rolling Date

Any help with this 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))))

Basically trying to apply a rolling date to a measure.  See an error?

4 Replies
andrey_krylov
Specialist
Specialist

The expression does contain an error, but I still do not understand what you want to achieve

Anonymous
Not applicable
Author

Trying to create a measure that will sum order sales if they fall within the last 30 days. 

balabhaskarqlik

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))))

balabhaskarqlik

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))))