Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

mazdamiata
New Contributor

Last 3 days and Month to date

Hi All,

I have the following expressions:

Current Month to date

= sum({$<Month={"$(=Date(Max(Month),'MMM-YY'))"}>}[Sales])

Previous Month to date

= sum({$<Month={"$(=Date(addmonths(Max(Month),-1),'MMM-YY'))"}>}([Sales])

these 2 works fine but i want to add another field that could see less 3 days Current Month to date and less 3 days Previous Month to date. e.g. i select July 1 to 5 but it would only select July 3 to 5 only on the next two expressions.

My Script below:

LOAD

Day (Date) as DayDate,

Month( Date) as MonthDate,

Year (Date) as YearDate,

Date(Date,'MM-DD-YYYY') as Date,

Date(Date,'MMM-YY') as Month,

Sales,

Customers

;

SQL SELECT * FROM dbo.customers;

Thanks

7 Replies
MVP
MVP

Re: Last 3 days and Month to date

What would you want to see when you select Jun 5th to Jun 15th? I am not completely sure I understand what your goal is?

mazdamiata
New Contributor

Re: Last 3 days and Month to date

Hi Sunny,

For example i select July 1 to 5 ( month to date) i can see these transaction details but also want to see together with the last 3 days July 3 to 5 (month to date).

mazdamiata
New Contributor

Re: Last 3 days and Month to date

the user wants to see last 3 days vs month to date transactions in their report.

Re: Last 3 days and Month to date

Perhaps this?

Current MTD

= sum({$<DayDate={">=$(=Max(DayDate-2))<=$(=Max(DayDate))"}, Month={"$(=Date(addmonths(Max(Month),-1),'MMM-YY'))"}>}[Sales])

Previous MTD

= sum({$<Month={"$(=Date(addmonths(Max(Month),-1),'MMM-YY'))"}, DayDate={">=$(=Max(DayDate-2))<=$(=Max(DayDate))"}>}([Sales])

mazdamiata
New Contributor

Re: Last 3 days and Month to date

Capture.PNG

Here is a visual guide

mazdamiata
New Contributor

Re: Last 3 days and Month to date

Hi Anil,

it didnt work.

MVP
MVP

Re: Last 3 days and Month to date

So, the user will never select Jun 5th to Jun 15th? or Jun 1st to Jun 15th? You are repeating the same example over and over... I am looking for understanding the requirement based on multiple different selections

Community Browser