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

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

how to solve this logic

Hi All,

I have two tables, table 1 contains multiple products with sales and sales date, Table 2 has product and lead time for each product.

now I want to create a table: where I want to start a start date from calendar object and  the sales should be calculated as from StartDate to StartDate+LeadTime.

Suppose for Product A the leadtime is 10 and for Product B the lead time is 6

and If I enter the startdate as 1/20/2016 so the sales for product A should be from 1/21/2016 to 1/30/2016 and for product B from 1/21/2016 to 1/26/2016.

I have attached the sample qlikview file and xl data file.

Below is the expected output for the attached data.

ProductSales
Product A100
Product B60

Thanks for you help.

1 Solution

Accepted Solutions
tresesco
MVP
MVP

In this case, set analysis would not be ideal. Try like:

Sum(If(Date>Date(vStartDate) and Date<=Date(vStartDate+LeadTime), Sales))

Untitled.png

View solution in original post

2 Replies
tresesco
MVP
MVP

In this case, set analysis would not be ideal. Try like:

Sum(If(Date>Date(vStartDate) and Date<=Date(vStartDate+LeadTime), Sales))

Untitled.png

amayuresh
Creator III
Creator III

I tried this but is not working for me

Variable vStartDate=Max(SalesDate) then write expression in chart with Product as Dimension

=Sum(If(SalesDate>Date(vStartDate) and SalesDate<=Date(vStartDate+LeadTime), Sales))