Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Hiii, i have one doubt regarding qlikview.

i have one pivot table with month dimension  and two measures like this

23 Replies
Not applicable
Author

      i have one pivot table with monthdimension and two measures like this 

             jan  feb  mar  april  may  jun  july  aug  sep  oct  nov  dec

sales1    10   20     20    10    30  40     10   20     20   30   10   20

sales2   30    20     20     50   60   70     80    10    80   20   20  90

so here i need a column at right side which adds last 3 months values for baoth sales1 and sales2 like this

            jan  feb  mar  april  may  jun  july  aug  sep  oct  nov  dec     latest_3_months

sales1    10   20     20    10    30  40     10   20     20   30   10   20         60

sales2   30    20     20     50   60   70     80    10    80   20   20  90       130

could u please tel me...

adamdavi3s
Master
Master

Please don't duplicate your threads!!!!!!!

Not applicable
Author

Use set analysis to get last 3 months

hemanthaanichet
Creator III
Creator III

Hi Durga

Try this:

sum(aggr(rangesum(above(total sum({<Month=>}Amount),0,3)),Month))


Go to this link:

https://community.qlik.com/docs/DOC-4252

Not applicable
Author

can u give me the expression for the set analysis to get the sum of last three months for both measures(sales1 and sales2)

Not applicable
Author

thanku for ur response hemanth... but i need the last three months sum for both measures(sales1 and sales2)  in single column only... as i mentioned above... could u please tel mee that

hemanthaanichet
Creator III
Creator III

try this:


month refers month field name

sales1 refers sales1 field name

sales2 refers sales2 field name


sum(aggr(rangesum(above(total sum({<Month=>}sales1),0,3)),Month))


sum(aggr(rangesum(above(total sum({<Month=>}sales2),0,3)),Month))


Regards

hemanth

Anil_Babu_Samineni

To get Sales1 and Sales2 for last 3 months


Sum({<Month = {"$(=AddMonths(Month,-3))"}>} (Sales1 + Sales2))


OR


Sum({<Month = {">= Max(Month) <= Max(Month)-3"}>} (Sales1 + Sales2))


OR


Sum({<Month = {">= Max(Month) <= AddMonths(Month,-3)"}>} (Sales1 + Sales2))

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful