# New to Qlik Sense

If you’re new to Qlik Sense, start with this Discussion Board and get up-to-speed quickly.

Announcements
Don't miss the upcoming Q&A with Qlik session on Qlik Application Automation on November 16th! REGISTER NOW
cancel
Showing results for
Did you mean:
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

2 Replies
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

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.

Tags
Community Browser