Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
ramrongala
Contributor II
Contributor II

How to show last 18 months data from current month

Hi Guys,

i am facing some issue -- to showing last 18 months data.

but i am unable to restrict the months and sum also, its showing all data and sum also not working.

Please help on this, i have attached my QVW application. 

so you can change the code and revert back Please

Thanks,

1 Solution

Accepted Solutions
sunny_talwar

Can't run your app, but try this

LOAD Name, 
     [Sales Date] as Date,
     Date([Sales Date],'DD/MM/YYYY') as [Sales Date], 
     year(Date([Sales Date],'DD/MM/YYYY')) as [Sales Year],
     Month(Date([Sales Date],'DD/MM/YYYY')) as [Sales Month],
     'Q' & CEIL(NUM(MONTH(Date([Sales Date],'DD/MM/YYYY')))/3) AS [Sales Quarter],
     Date(MonthStart([Sales Date]),'MMM YYYY') as [MMM YYYY],
     Sales
FROM
[..\QVD\last 18 months.xlsx]
(ooxml, embedded labels, table is Sheet1);

View solution in original post

4 Replies
sunny_talwar

Try this

Sum({<[Sales Date]={">=$(=Date(MonthStart(Max([Sales Date]), -17), 'MM/DD/YYYY'))<=$(=Date(Max([Sales Date]), 'MM/DD/YYYY'))"}, [Sales Year], [Sales Month], [Sales Quarter]>}Sales)
ramrongala
Contributor II
Contributor II
Author

Hi Bro,

Months restriction working fine,but sum not working fine.

if you see the bar or pivot table it's showing  individual values not sum ie sum not happen.

i need some of each month

I  attached latest copy please have  a look

sunny_talwar

Can't run your app, but try this

LOAD Name, 
     [Sales Date] as Date,
     Date([Sales Date],'DD/MM/YYYY') as [Sales Date], 
     year(Date([Sales Date],'DD/MM/YYYY')) as [Sales Year],
     Month(Date([Sales Date],'DD/MM/YYYY')) as [Sales Month],
     'Q' & CEIL(NUM(MONTH(Date([Sales Date],'DD/MM/YYYY')))/3) AS [Sales Quarter],
     Date(MonthStart([Sales Date]),'MMM YYYY') as [MMM YYYY],
     Sales
FROM
[..\QVD\last 18 months.xlsx]
(ooxml, embedded labels, table is Sheet1);
ramrongala
Contributor II
Contributor II
Author

Thank you very much Bro,its working fine