Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Look at previous month when date is dimension?

Hi, I am trying to look to count orders over multiple months when a month is a dimension? ie. For May, I want 3 columns that show the count of orders for May, the count of orders for May + April, and the count of orders for May + April + March. Is this possible?

If below was my data.

  

MonthOrder Count
January8
February4
March5
April3
May12

I would want my chart table to look like below.

   

MonthOrder CountOrder Count 2 MonthsOrder Count 3 Months
March5917
April3812
May121520

Thank you in advance for the help.

1 Solution

Accepted Solutions
swuehl
MVP
MVP

You can do this e.g. using an AsOf table approach:

The As-Of Table

View solution in original post

6 Replies
swuehl
MVP
MVP

You can do this e.g. using an AsOf table approach:

The As-Of Table

vishsaggi
Champion III
Champion III

I am not sure if this is the right way of doing it but you can try this :

phaneendra_kunc
Partner - Specialist III
Partner - Specialist III

You can use "Accumulation" with 2 & 3 steps back to get to your result.

Attached is the example.

vishsaggi
Champion III
Champion III

If you are using a personal edition try this:

Dim: Month,

Expr1: Sum(OrderCount)

Expr2:

= IF(Month = 'March', RangeSum(Above(Sum(OrderCount),0,2)),

  IF(Month = 'April', RangeSum(Above(Sum(OrderCount),0,2)),

  IF(Month = 'May',   RangeSum(Above(Sum(OrderCount),0,2)))))

Expr3:

= IF(Month = 'March', RangeSum(Above(Sum(OrderCount),0,3)),

  IF(Month = 'April', RangeSum(Above(Sum(OrderCount),0,3)),

  IF(Month = 'May',   RangeSum(Above(Sum(OrderCount),0,3)))))

  

Thanks,
V.

sunny_talwar

Why so complicated, why not these expressions:

=If(RowNo() >= 3, Sum(OrderCount))

=If(RowNo() >= 3, RangeSum(Above(Sum(OrderCount),0,2)))

=If(RowNo() >= 3, RangeSum(Above(Sum(OrderCount),0,3)))

Capture.PNG

Not applicable
Author

Thanks a ton. The As Of Table was exactly what I was looking for. It basically allows me to look at a date point in time, and look back at previous dates for information.