Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
md_qlikview
Creator II
Creator II

Date vs Previous Month of Same Date using Set expression

Hello All,

I need to get Sales and Sales of Previous month wrt date in a table.
I am struggling to get this by set expression. Is there any way to accomplish this using set expression.

Eg.
Date              |  Sales                                                       |   Sales on Same Date Of Last month

01/04/20     | Sum(Sales)  as On 1st Apr 20         |   Sum(Sales) as on 1st March 20

Thanks In Advance

 

2 Replies
jer_2011
Creator II
Creator II

Hola, mi ingles No es bueno, te explicare paso a paso

Se tendrá que determinar las fechas iniciales y finales

Primero es determinar la fecha del día actual (hoy)

Today()     es igual a 18/04/2020

Con este dato podremos determinar:

La fecha inicial y final del mes actual

Monthstar( Today() )  es igual a 01/04/2020

Monthend( Today() ) es igual a 30/04/2020

 

La fecha inicial y final del mes anterior

Monthstar( Today(),-1 )  es igual a 01/03/2020

Monthend( Today(),-1 ) es igual a 31/03/2020

 

Entonces las ventas del mes actual son:

sum({<DataDate={'>=$(=MonthStart( today() ) )<=$(=MonthEnd( today() ) )'} >} Sales)

Entonces las ventas del mes Anterior son:

sum({<DataDate={'>=$(=MonthStart( today() ,-1) )<=$(=MonthEnd( today(),-1 ) )'} >} Sales)

 

Espero te ayude.

 

Saludos

md_qlikview
Creator II
Creator II
Author

Hi,

thank you for your time and efforts for this. You have explained here, how to calculate Sales for entire current and previous month. However, I am interested to see sales on Individual day, for current and previous month within a table. with date as dimension.