Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
kdr_Qv
Contributor III
Contributor III

How to get Last 3 Months sales data for each date dynamically (excluding Current month)

Hi Guys,

I have Date as dimension in  bar chart (presing latest  4 months date) and measure as sum(sales)..

Now i have to add another measure  to find sum(sales) for last 3 months dynamically excluding current month.. for each date wise going back for last 3 months of Sum(sales)?

after that i have to  calculate AVg sales -->   current date(sales)/last 3 months sales

sample data below  having  dates from March, April, may, june month dates.. 

kdr_Qv_0-1591059587280.png

 



Labels (3)
17 Replies
tm_burgers
Creator III
Creator III

I'm not sure why my AGGR solution does work for you - I have a very similar dataset that I used and tested it on and it worked well for me.

kdr_Qv
Contributor III
Contributor III
Author

you mean  ur used below expression  right

AGGR( nodistinct Sum({1< [Report Date]={">=$(=Date(monthstart(=max([Report Date]),-3), 'MM/DD/YYYY'))<=$(=Date(monthend(=max([Report Date]),-1), 'MM/DD/YYYY'))"} Saleable ), [Report Date.autoCalendar.Month])                         /  (date(monthend(max( [Report Date]),-1))-Date(monthstart(max( [Report Date]),-3)))

Here also am getting  values only for the  first date  of every month ..  reamin dates null as shown below.

kdr_Qv_0-1591284923708.png

@tm_burgers 

kdr_Qv
Contributor III
Contributor III
Author

HI SUnny ..

with This logic..  the values are coming only first day of the every month.. its not repeating till month end..

can you please let me know how to drag same  first date value till the month end..

kdr_Qv_0-1591370650145.png

@sunny_talwar @Gysbert_Wassenaar  @hic  @tresesco   @Antoniotiman 

sunny_talwar

Would you be able to share a sample where we can see the issue and try it out?

kdr_Qv
Contributor III
Contributor III
Author

Hi Sunny , 

Please find my Qvf file attached here with sample data..

 

@sunny_talwar 

sunny_talwar

I see that you tried implementing As-Of Table. Would you be able to share SampleData.xlsx so that  I can try reloading the dashboard to try and fix AsOfTable to make this work.

sunny_talwar

Check the attached dashboard to see if this is what you want

image.png

kdr_Qv
Contributor III
Contributor III
Author

 sunny, 

I need this  should split by dimension  as date field .. 

month wise  its working fine.. am expecting date wise..    for all june month dates  it should display same data( sum of mar, Apr, MAy month)

 

 

 

@sunny_talwar