Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
chriscools
Creator II
Creator II

date dimension showing only today

Hello,

i have a pivot table where date is the dimension and several calculated fields behind it.

i want to show this pivot table completely on one page, but on another page, i want to  show the same pivot table, but allways only the values of today.

i think this means that i have to include a "calculated dimension" instead of my normal "date" dimension.

i tried with :

date = date() or date = today

but this doesn't work.

is my syntax wrong?

or is my whole approach wrong?

Can anyone help me with this?

thanx!

chris

11 Replies
johnw
Champion III
Champion III

Yes, you would then get to use VOORZIENE_LEVERINGSDATUM as a normal dimension.

If you have a large data set, I would expect set analysis to work faster.  I MAY be wrong, and it is always worth testing if you see performance problems.  Basically, performance differs from version to version, and differs depending on your data model and chart, so it's difficult to say for certain that one approach is better than another for any specific case.  All that said, set analysis seems to win the majority of speed contests.  It's also very flexible.

Unfortunately, as you've noticed, the syntax for set analysis is pretty dense.  But yes, you can take multiple restrictions into consideration.  So for example:

sum({<[VOORZIENE_LEVERINGSDATUM]*={">=$(=today())<=$(=date(today()+10))"}
     ,dayname-={'saterday','sunday'}>} Revenue)

johnw
Champion III
Champion III

Hmmm, the FASTEST approach in a case like this would probably be to identify the days of interest during the load itself, specifically the load of a calendar table.

,if([VOORZIENE_LEVERINGSDATUM]>=today()
AND [VOORZIENE_LEVERINGSDATUM]<=today()+10
AND NOT match(dayname,'saterday','sunday')

   ,[VOORZIENE_LEVERINGSDATUM]) as "Only Display These Dates"

Then use "Only Display These Dates" as the dimension in your chart (obviously change the name to something that makes more sense).  That's what I would probably personally do.  That might also be more clear than set analysis.  I tend to prefer script solutions like this to set analysis solutions as long as I am not doing any accumulations in the script.

In order of decreasing performance in my experience:

  1. Script
  2. Set analysis
  3. Conditional aggregation like sum(if(...))
  4. Calculated dimensions