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

Announcements
Qlik Connect 2026! Turn data into bold moves, April 13 -15: Learn More!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Retrieving month from date value within set analysis expression

Hi all,

I'm new to Qlik Sense Desktop, and am having what seems to be a relatively simple problem. I have two data fields, BOL and Finish_DateTime. I'm trying to create a series of gauges that show the number of distinct BOL values broken out by month. My expression to retrieve a count of all distinct BOL values is:


COUNT(DISTINCT(BOL))

This is relatively straightforward. The problem I'm encountering is that I'd like to filter based upon the month of the Finish_DateTime value; something similar to:

COUNT({$<MONTH(Finish_DateTime)={1}>}DISTINCT(BOL))

I'd like this expression to work for January, and will then create similar gauges for the other months. I'm just having trouble figuring out the proper syntax to say, "Hey, only give me records where the month is 1 (or whichever month I need)." Any advice on the matter would be greatly appreciated.

1 Solution

Accepted Solutions
jonathandienst
Partner - Champion III
Partner - Champion III

The LHS of a set expression must be field name. If you are going to be using month as a dimension I would add a Month derived field during the LOAD:

     LOAD Finish_DateTime,

          Month(Finish_DateTime) As FinishMonth,

Now you can use FinishMonth in your set expression. This is the best solution.

Otherwise you could try

     COUNT({$<Finish_DateTime={"=$(Month(Finish_DateTime) = 'Jan')"}>} DISTINCT BOL)

     (May need to play with the search text to get that to work)

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein

View solution in original post

3 Replies
sunny_talwar

May be this:

Count({$<Finish_DateTime={"=Num(Month(Finish_DateTime)) = 1"}>}DISTINCT BOL)

jonathandienst
Partner - Champion III
Partner - Champion III

The LHS of a set expression must be field name. If you are going to be using month as a dimension I would add a Month derived field during the LOAD:

     LOAD Finish_DateTime,

          Month(Finish_DateTime) As FinishMonth,

Now you can use FinishMonth in your set expression. This is the best solution.

Otherwise you could try

     COUNT({$<Finish_DateTime={"=$(Month(Finish_DateTime) = 'Jan')"}>} DISTINCT BOL)

     (May need to play with the search text to get that to work)

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
qlikviewwizard
Master II
Master II

Hi Try like this in Expression:

Count({$<Finish_DateTime={"=Num(Month(Finish_DateTime)) = 1"}>}Distinct BOL)