Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Best way to range date

HI,

Can someone please advise on the best way to range a certain date?

Lets say I have a column with date from 01/01/205 to 01/01/2012.

Another column with Sales Amount.

I would like to range the sales from Fev/2009 to present month Mai/2012.

Also to include month on the range.

Thnaks a lot.

Jorge

1 Solution

Accepted Solutions
chematos
Specialist II
Specialist II

Hi,

See that you could create two new variables with the date´s values you want and replace those to StartDate and EndDate so I write both options:

sum({<Date={'>=$(=StartDate)'},Date={'<=$(=EndDate)'}>}[Sales Amount])

sum({<Date={'>=$(=$(vStartDate))'},Date={'<=$(=$(vEndDate))'}>}[Sales Amount])

Try this and tell me.

Regards,

Chema

View solution in original post

3 Replies
chematos
Specialist II
Specialist II

Hi,

See that you could create two new variables with the date´s values you want and replace those to StartDate and EndDate so I write both options:

sum({<Date={'>=$(=StartDate)'},Date={'<=$(=EndDate)'}>}[Sales Amount])

sum({<Date={'>=$(=$(vStartDate))'},Date={'<=$(=$(vEndDate))'}>}[Sales Amount])

Try this and tell me.

Regards,

Chema

Not applicable
Author

Thanks man,

The first option worked fine.

Now, when a select a diferent month, the date isn´t displayed. The sales amount is fixed to my variables values, do you know how can I leave more flexible? Is it what the second option does?

Thks

Jorge

chematos
Specialist II
Specialist II

Hi Jorge

With the second option you could choose any dates you want. You need to create 2 entry box where you can write the MinDate and the MaxDate associated with the new variables, so you could use this:

sum({<Date={'>=$(=$(vMinDate))'},Date={'<=$(=$(vMaxDate))'}>}[Sales Amount])

You could do the same thing with months if you prefer but making a month selection:

sum({<Month={'>=$(=$(vMinMonth))'},Date={'<=$(=$(vMaxMonth))'}>}[Sales Amount])

Si prefieres, para siguientes ocasiones usamos el español.

Saludos, espero que te ayude.