Skip to main content
Announcements
Qlik Connect 2025: 3 days of full immersion in data, analytics, and AI. May 13-15 | Orlando, FL: Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Sum if Date1 = Date2 (Reference to another field in Set Analysis)

Hi out there,

perhaps someone can help me with this issue I'm having:

I want to calculate the sales for customers that became new customers a given month and placed orders in following months.  So I have two Date-Fields: "NewCustomerMonth" and "SalesMonth"

I tried to summarize the issue in this simplified example:

   

Data
NewCustomerMonthSalesMonthSales
11200
12

100

I want to calculate the revenues after x months passed for all new customers from Month 1.

So I'm looking for the following result:

    

NewCustomerMonthSales in Month1Sales in Month2Sales in all Months
1200100300

Instead I get:

    

NewCustomerMonthSales Month1Sales Month2SalesTotal
1300

I have tried these two ways (in for the first column i.e. "Sales in Month1"):

1. sum( {$ < Key = {"=(SalesMonth = NewCustomerMonth)"} > } Sales)

or

2. sum( {$ < NeukundenKalender._M = p(Kalender._M) >  }

with the same result.

How can I get QlikView to sum the Sales "for the SalesMonth equal to the NewCustomerMonth".?

I've also tried plain "IF" but that does not work, because I have not both columns in the Chart (I think it is because of that)

I'd appreciate if anybody could help or has any ideas... mine have run out expect doing it manually........

Thanks

Alejandro

5 Replies
anbu1984
Master III
Master III

Check this

Not applicable
Author

What does NewCustomerMonth means in your example? I can understand that it is a date, but does it show the number of months since our customer is with us? What I can imagine is that you want a table with a dimension like NewCustomerMonth,

expressions be like =sum({<SalesMonth='Month1'>}Sales)

=sum({<SalesMonth='Month2'>}Sales)

last expression: sum(Sales)

It is not the most elegant solution, on the contrary, but it will work. Let me know if it helped you.

Best,

T

Not applicable
Author

Thanks,

NewCustomerMonth is the actual month a customer made its first order, thus becoming a customer.  The expressions you proposed do work.  But since I have many years of data and need to sum sales "after 3 months of becoming a customer", "after 6 months..."  and so on, I was trying to find a way to do it dynamically, in "spoken" formula like this:

Sum of Sales, when SalesMonth = NewCustomerMonth + NewCustomerMonth+1 + NewCustomerMonth+2.

@Anbu Cheliyan: The use of the second time dimension as columns in a pivot does not help me because there are many other Expressions in the table and I still cannot make partial sums (first 3 months, first 6 months after the date NewCustomerMonth)

Regards

Alejandro

Not applicable
Author

Hi Alejandro, did you manage to sort this one out at all? I have exactly the same issue...

tresesco
MVP
MVP

Hi Richard,

I suggest you to create a new thread with a sample qvw to work on. You would be offered some useful suggestions by people here, I believe.