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

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Day by day calculation

Hi All,

I have a table with the following fields: Brand, Post_Date, Count(Id). To each date I want to calculate the count of the previous day.  I tried several thing with no luck. I only managed to calculate for today()-several days.

See calculation below:

= count(TOTAL {<Post_Date = {"$(=Date(today()-9))"}>} Id)

I want to replace the Date(today()-9)) to something like Post_Date-1.


Any ideas?

Thx,

Hila.

10 Replies
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

Maybe you can use the above function: = above(count(Id))

What won't work is a set analysis expression. The set is calculated at the chart level, not the row level.


talk is cheap, supply exceeds demand
Not applicable
Author

Thanks for your replay Gysbert!

We tried that option and it didn't work because not all records are displayed.

Not applicable
Author

Hi,

try this

= count( {<Post_Date = {"$(=Max(Post_Date)-1)"}>} Id)

Not applicable
Author

Thank Rakesh but it's not the answer.

I actually tried to do the calculation of the day before in another column (Post_Date - 1) and to use Column(1) in the set analysis but I haven't succeeded yet..

Thanks for you help.

ashwanin
Specialist
Specialist

Hi Hila,

Can you post some sample data.

Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

In that case you'll have to create an additional table in the script. See attached qvw.


talk is cheap, supply exceeds demand
Not applicable
Author

Hi Gysber!

Thanks for the great qvw

I was actually trying to avoid duplicating the table since it is very big.

I hope to find a solution in set analysis..

Thanks!!

Hila.

Not applicable
Author

Hi All,

I managed to get some progress with the following calculation:

= count(  {<Post_Date = {"$(=Date(Max(Post_Date)-1))"}>} Id)

The issue is I get the solution only for the max(Post_Date). When I tried to remove the MAX I don't get any result.

ideas?

Thx!

Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

You don't have to duplicate the table. All you need to do is add a table that links each date with the day before. If you have 365000 different date values in your fact table, i.e. about a thousand years, then your AsOf table will contain twice that number or 730000 records. But your fact table, with possibly million of records, will not change at all.


talk is cheap, supply exceeds demand