Qlik Community

Qlik Education Discussions

Discussion Board for collaboration related to Qlik Education.

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
Employee
Employee

Re: Current Day Sales Vs Previous Day Sales

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

5 Replies
Employee
Employee

Re: Current Day Sales Vs Previous Day Sales

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

MVP & Luminary
MVP & Luminary

Re: Current Day Sales Vs Previous Day Sales

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

above(sum(Sales))

-Rob

MVP & Luminary
MVP & Luminary

Re: Current Day Sales Vs Previous Day Sales

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

Re: Current Day Sales Vs Previous Day Sales

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!!!

Employee
Employee

Re: Current Day Sales Vs Previous Day Sales

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

Community Browser