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: 
tigra999
Contributor III
Contributor III

Expression for calcsales diff (%) from previous Month, Quarter, Year and YTD vs previous full Yr

Hello QS experts,

I have several expressions to show Sales by Yr/Month, Yr/Q and Year based on a db table called " order_date " in a line graph. Expressions below.

=YEAR (order_date) & Month (order_date)

=if(month(order_date) = '01',Year(order_date)&' Q1',if(month(order_date) = '02',Year(order_date)&' Q1',if(month(order_date) = '03',Year(order_date)&' Q1',
if(month(order_date) = '04',Year(order_date)&' Q2',if(month(order_date) = '05',Year(order_date)&' Q2',if(month(order_date) = '06',Year(order_date)&' Q2',
if(month(order_date) = '07',Year(order_date)&' Q3',if(month(order_date) = '08',Year(order_date)&' Q3',if(month(order_date) = '09',Year(order_date)&' Q3',
if(month(order_date) = '10',Year(order_date)&' Q4',if(month(order_date) = '11',Year(order_date)&' Q4',if(month(order_date) = '12',Year(order_date)&' Q4'))))))))))))

=year(order_date)

Now I would like to calculate a % (average) sales price difference between the previous Month and Previous Quarter and previous Year, db table is called price_sales.  (% diff month by month, quarter by quarter, year by year and YTD (i.e. current month vs last full last year)

My question is how I could build the full expression/formula to show this in a graph/curve %. Any (simple) solutions?

Thanx for support!

 

BR

peter

0 Replies