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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
lankmachine
Partner - Contributor II
Partner - Contributor II

Using Set Analysis to Filter a Histogram by Date

Hello,

I'm trying to create a histogram from my data that selects for only the current date. 

Currently, I have this as my "Field":

={<[DATE_FIELD] = {"$(=Date(Today(), 'M/D/YYYY'))"}>} [VALUE_FIELD]

But this isn't filtering out the other dates. Is there another approach I should be taking?

Thanks in advance!

Labels (1)
3 Replies
hic
Former Employee
Former Employee

You must use an aggregation function somewhere. Otherwise the set analysis won't work.

For example, you can use this as measure:
={<DATE = {"$(=Date(Today(), 'M/D/YYYY'))"}>} Sum(VALUE)

And you can use this as dimension:

=Aggr({<DATE = {"$(=Date(Today(), 'M/D/YYYY'))"}>} Only(DATE),DATE)

Further, if you have the correct DateFormat in the script, e.g.
SET DateFormat='M/D/YYYY';

then you don't need the formatting function in your set expression. Today() returns the correct format, so you can use
={<DATE = {"$(=Today())"}>} Sum(VALUE)

lankmachine
Partner - Contributor II
Partner - Contributor II
Author

For the histogram, I'm not seeing any dimensions or measures that I can change. There are only fields, which I can add several to.

kavicsgym
Creator
Creator

Hi HIC,

Acc to Qlik Help: "There are some limitations to the dimension used in a histogram.

  • The dimension must be a numerical field.
  • You cannot use a master dimension that was created using the expression editor, even if the resulting field is numeric.
  • The dimension cannot be based on an aggregation function."

    My Calc Dim is: =Num(Aggr(Only({<XY_FLAG={'Y'}>}SCORE),SCORE)) 
    It does not work. SCORE is Numeric Intiger field.