# QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
Coming Aug. 9: New Simplified Authoring for Qlik Sense SaaS – For Details, CLICK HERE
cancel
Showing results for
Did you mean:
Creator

## 3 Month Prior Sales in set-analysis/Scripting

Hi folks,

I'm stuck in a problem where I need to present the 3 Month prior sales (including the 3rd Month) in a straight table , but im unable to do so.

here im attaching the image where you can find the sample example of the problem stated above.

any sort of help is appreciate.

Thanks,

Abhay

1 Solution

Accepted Solutions
Creator
Author

=If(Sum(Sales) > 0, Above(sum({<[Month-Year]>}Sales),3))

This seems to be working as expected.

10 Replies
Creator III

try this:

Creator
Author

tried this , but it doesn't seem to work.

I used this formula.

MVP

May be try this

Above(Sum(Sales), 3)

Missing Manual - Above() and Below()

Creator
Author

hey this works if i dont make any selection from the month or year.

but as you see if i select a particular year i wont be able to see data for JAN FEB MAR as according to the formula there's nothing above it.

Any other alternative would also work .

Thanks alot.

Partner - Contributor III

Hi,

I prefer using a Month Number in the calendar for these type of queries.

MonthNum=Year*12 + Month.

Now using this you can calculate the value in Set

Try  Sum({<MonthNum={Max(MonthNum)-3},Month=,Year=>}Sales)

Regards,

Devyanshu

Creator
Author

I did try using this expression, It din seem to work out.

Sum({<MonthNumber={'Max(MonthNumber)-3'} ,Month=,Year=>}Sales)

Partner - Creator

Hi Abhay,

I have done this before where I used a resident load to bring the data back in as a comparative figure.  It gives more flexibility for doing period comparisons and as far as I know it's more efficient than a complex expression with set analysis.

I have attached a simple model of how this could work.

Hope this helps.

Rod

Creator
Author

=If(Sum(Sales) > 0, Above(sum({<[Month-Year]>}Sales),3))

This seems to be working as expected.

Creator
Author

This works too Rod , Thanks alot