Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
ananyaghosh
Creator III
Creator III

How to calculate previous day, maonth, week and year sum(sales)

Hi,

I need to show previous day, month, week, Year's sum(sales).

Also I am attaching a QVW for my sample data source.

Please give me a straight table calculating previous day, month, week and year and also rolling period of 9 month data.

Thanks,

Sandip

10 Replies
MindaugasBacius
Partner - Specialist III
Partner - Specialist III

Try looking for Set Analysis.

This might help:

Previous day: Sum({<Date = {"$(=Date(Today() - 1, 'YYYY.MM.DD'))"}>} Sales)

Previous week: Sum({<Date = {">=$(=Date(WeekStart(Today(), -1), 'YYYY.MM.DD'))<=$(=Date(WeekEnd(Today(), -1), 'YYYY.MM.DD'))"}>} Sales)

etc.

ananyaghosh
Creator III
Creator III
Author

Hi,

I need to calculate the values based on the DB filed [Process Date], not on the current date. Please help me based on that filed and make a straight table on that.

Thanks,

Sandip

Anonymous
Not applicable

Replace Today() with max([Process Date]).

PrashantSangle

Hi,

In mindaugasbacius‌ solution replace today() with your date field i.e. [Process Date]

Regards,

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
ananyaghosh
Creator III
Creator III
Author

Hi,

I am using the following expression:

sum({<[Process Date]={">=$(=date(max([Process Date])-1,'MM/DD/YYYY'))<=$(=date(max([Process Date]),'MM/DD/YYYY'))"}>}[Sales Posting Amount USD])

and it is not working for Previous day clculations

ananyaghosh
Creator III
Creator III
Author

Hi,

I am using this:

sum({<[Process Date]={"$(=date(max([Process Date])-1,'MM/DD/YYYY'))"}>}[Sales Posting Amount USD])

but did not get any data

marygrace
Contributor III
Contributor III

Hi,

  I am looking for the solution. I need to count the orders for Yesterday + today, selecting Date today, Monthly, Yearly, Previous Day  Somebody has a solution

?

Thank you!

lorenzoconforti
Specialist II
Specialist II

Can you please post your application and a clear description of what you need to achieve? It would be great to understand what number you expect to see. I think the issue in the thread above is that it is not 100% clear (at least to me) what needs to be achieved

marygrace
Contributor III
Contributor III

Hi Lorenzo,

Monday to Saturday We received Sales Orders, we have deadline to release Orders until 16:40 hrs. I created a flag to identified the Orders received before 16:40hrs flag =1 and after= 0. Monday to Saturday. What I need is count Orders received from yesterday after 16:40 flag =0 and today before 16:40 flag=1. The measurement need to Count the Orders for specific selection. Year, Month, Day, Date.

Please let me know if it is clear.

Thank you