Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Current Day Sales Vs Previous Day Sales

Good day!

I'm new, sorry

I've read a lot about CurMonth Vs PrevMonth, YoY and so on

But my q. about  Current Day Sales Vs Previous Day Sales

Please, help me

It's so easy from MS PowerPivot, let me understand Qlik Sense and love it

We've got a table to load:

date          dep                      sales
1/1/15          А                          100
2/1/15          А                          110

How can we make this table in Qlik Sense?

date          dep                      Current Day Sales            Previous Day Sales
1/1/15          А                          100                                                  0
2/1/15          А                          110                                                 100

Is it possible?

Thank you very much!!!

Mikhail

1 Solution

Accepted Solutions
Agis-Kalogiannis
Employee
Employee

Hi Mikhail

You can do something like this:

LOAD

  date,

  dep,

  sales,

  previous(sales) AS [Previous Day Sales]

FROM...

ORDER BY date;

This will return null for the first row so you can add an if statement to make it 0

if(isnull(previous(sales)), 0, previous(sales))  AS [Previous Day Sales]

Thanks

Agis

View solution in original post

5 Replies
Agis-Kalogiannis
Employee
Employee

Hi Mikhail

You can do something like this:

LOAD

  date,

  dep,

  sales,

  previous(sales) AS [Previous Day Sales]

FROM...

ORDER BY date;

This will return null for the first row so you can add an if statement to make it 0

if(isnull(previous(sales)), 0, previous(sales))  AS [Previous Day Sales]

Thanks

Agis

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

Assuming the row above is the previous day, you can also use the chart expression for measure:

above(sum(Sales))

-Rob

Oleg_Troyansky
Partner Ambassador/MVP
Partner Ambassador/MVP

Generally speaking, to build a solution that covers all possible situations, you should learn how to create Calendar flags in you dataset (or ask your developers to create these flags for you).

Specifically, to satisfy your need to show a Date (Week/Month/Year) as a dimension and to display both Current and Previous Sales, you need to implement a data modeling solution called "As of Table". There are many sources that explain that, including my own blog article at www.naturalsytnergies.com/blog.

cheers,

Oleg Troyansky

Check out my book QlikView Your Business - now available to pre-order on Amazon!

Not applicable
Author

thank you very much!

I see how the question can be resolved

I've done it with "previous" method and it works

I see how big is qlik world!!!

Agis-Kalogiannis
Employee
Employee

Hi Mikhail

Could you please mark the answer as Helpful or Correct so as to close the discussion?

You can use the HELPFUL - CORRECT buttons on the bottom of the answer.

Thanks

Agis