Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
KKumar92
Contributor III
Contributor III

Lost Sales Calculation (Current VS Last Week)

Hi All,

I want to calculate the Sales Lost in current week compared to last week. For example;

If my sales is 0 on 2/3/2021 from 2.00pm to 4.00pm, but my sales exactly a week ago 23/2/2021 is 50 from 2.00pm to 4.00pm. So if I put this into a table I would want to generate an output as follow;

Date

From

To

Total Sales

Sales Lost

23/2/2021

2.00 pm

4.00 pm

50

0

2/3/2021

2.00 pm

4.00 pm

0

50

Please advise how this could be achieved.

Labels (2)
3 Replies
rbartley
Specialist II
Specialist II

Hi,

Have you tried using the Above() and Below() functions e.g. Sales-Above(Sales)

KKumar92
Contributor III
Contributor III
Author

Hi,

I have included the only two rows for the explanation purpose, where as in the actual data data set thee could be more rows than this.

Therefore, wouldn't be better to create a measure for the above requirement?

 

rbartley
Specialist II
Specialist II

Hi,

It depends on your actual requirement.  If the basis for comparison is always static, it would be more efficient to create a pre-calculated field in the data model, but it's difficult to say without a full example to work with.  In general, it is good practice to post a full explanation or, even better, a qvf file so that those who might like to help can do so without having to spend time creating  new app.  If you can post the qvf file, I can take a further look.