Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik GA: Multivariate Time Series in Qlik Predict: Get Details
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Sum of amount for rolling 6 months

Hi Team,

I using this expression in test box for showing value in USD but actually i need to show rolling 6 months data based on current month dynamically..

i have year,month fields..

=num(Sum(ValueUSD)/1000000, '$#,##0.00')


****The rolling 6 months means for example we are currently in Apr i need to show the data for (Mar-14,Feb-14,Jan-14,Dec-13,Nov-13,Oct-13)****

Please help me in solving the problem..

Thanks,

Rahul

1 Solution

Accepted Solutions
MK_QSL
MVP
MVP

Current Month is April and hence your output should be

Oct-13

Nov-13

Dec-13

Jan-14

Feb-14

Mar-14

But as per Anand's reply, you will get for 5 months....

Please check and let me know if I am wrong...

I think my answer is correct !

View solution in original post

23 Replies
MK_QSL
MVP
MVP

If you have date field in your database, use below...

=num(Sum({<[YourDateField] = {'<=$(=MonthEnd(AddMonths(Today(),-1)))>=$(=MonthStart(AddMonths(Today(),-6)))'}>}ValueUSD)/1000000, '$#,##0.00')


Update : above solution tested and working fine in my application.

If it is not working, let me know the Format of YourDateField.

Not applicable
Author

I am able to do in chart but how to do it text box..

its_anandrjs
Champion III
Champion III

Write like this in text box

MonthYear = YourMonthyearField




=num(Sum( {$<MonthYear = {">$(=num(AddMonths(MonthYear,-6))) <=$(=Num(MonthYear))"}>}  ValueUSD)/1000000, '$#,##0.00')

MK_QSL
MVP
MVP

Try my solution in text box

its_anandrjs
Champion III
Champion III

Update

Write like below in text box

In MonthYear = YourMonthYearField and if not avilable month year then write in load script like

MonthName(YourDatefield) as MonthYear,

=Num(Sum( {$<MonthYear = {">$(=Num(AddMonths(MonthYear,-6))) <=$(=Num(MonthYear))"}>}  ValueUSD)/1000000,

'$#,##0.00')



Not applicable
Author

I have month and year two different fields like Apr , FY14 some thing like this....and i dont have date filed..

its_anandrjs
Champion III
Champion III

You can write this in Text box also

=Num(Sum( {$<MonthYear = {">$(=Num(AddMonths(MonthYear,-6))) <=$(=Num(MonthYear))"}>}  ValueUSD)/1000000,

'$#,##0.00')



Or



=Num(Sum( {$<MonthYear = {'>$(=Num(AddMonths(MonthYear,-6))) <=$(=Num(MonthYear))'}>}  ValueUSD)/1000000,

'$#,##0.00')

its_anandrjs
Champion III
Champion III

With the help of Month and Year field in load script make the month year field like

Try like this

Month&' '& Date('20'&Right(FinancialYearFieldHere,2),'YYYY')  as MonthYear

May be provide sample.