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: 
maniram23
Creator II
Creator II

date function

Hi experts,

   I have one date field in my data.and some id,sales of data is there.

here if I select any date it has to go 7 days back.

here the data in date field is 01/01/2015 to 20/01/2015  for example

if I select 07/01/2015 it has to show 01/01/2015 and 07/01/2015 of both dates data.

same way if I select 01/01/2015 it has to show 25/12/2014  and 01/01/2015 of both dates data.

I have some ideas but those ideas are not giving proper result.

any ideas.

4 Replies
kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi,

You can use two expression and add them, just like below.

Sum({<Date = {"$(=Max(Date))"}>}Sales)

+

Sum({<Date = {"$(=Max(Date)-6)"}>}Sales)


Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
Not applicable

Could you post a sample document?

ans just simply try debugging date +7 to see if you are getting the correct date?

swuehl
MVP
MVP

You can use set analysis for this.

For example, create a straight table chart with dimension id and then two expressions:

=sum(sales)

=sum({<datefield = {"$(=Date(max(datefield)-6,'DD/MM/YYYY'))"}>} sales)

replace id, datefield and sales with your appropriate field names. You may need to adjust the Date() format code to match your format of datefield.

Kushal_Chawda

wan to show only for both dates or for all 7 days back. If it is for only both dates then you can go for what kaushik has suggested. If you want for all 7 Days then use below

Sum({<Date = {">=$(=Max(Date)-6)<=$(=Max(Date))"}>}Sales)