Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
inam
Contributor III
Contributor III

Date expression (current date to month end date)

Hello community,

 In holiday forward booking count Field I want date expression( today to end of month is the Forward booking).

below i used  this expression but not getting answer

= Count({<TOUR_START_DATE ={"(=Today())"}>}TOUR_START_DATE)

      today to end month
Product  FILE_TYPE  Holiday Backward Booking Holiday Forward Booking count
Domestic FIT 2638 0
GIT 1589 0
Total  4227 0
International FIT 5316 0
GIT 10488 0
Total  15804 0

 

I am using only Tour_Start_Date with  that I have calulate this.

Screenshot 2023-05-15 111614.png

 

 

Labels (3)
3 Replies
MayilVahanan

Hi

First of all, ur date column looks like Text, because, generally, if its date / num format, it should be in right side.

So, can you try to change it from Text to date format like

Load Date(Date#(TOUR_START_DATE, 'urdateformat'), 'urdateformat') as TOUR_START_DATE, .. from urdatasource;


Exp:
count({$<TOUR_START_DATE={">=$(=Date(Today()))<=$(=Date(floor(MonthEnd(TOUR_START_DATE))))"}>}
DISTINCT TOUR_START_DATE)

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
inam
Contributor III
Contributor III
Author

Thank yo so much MayilVahanan.

now expression is working fine

but I have one  more doubt

if I use this 

= Count({$<TOUR_START_DATE={">=$(=Date(Today()))<=$(=Date(floor(MonthEnd(TOUR_START_DATE))))"}>}DISTINCT TOUR_START_DATE)  // ans is 98

&

if I use this = Count({<TOUR_START_DATE = {">$(=Today())"}>} TOUR_START_DATE)   // ans is 361

but the Correct Ans is 174

MayilVahanan

Hi

Its depends on , how you want to count the values either distinct date or all dates.

= Count({$<TOUR_START_DATE={">=$(=Date(Today()))<=$(=Date(floor(MonthEnd(TOUR_START_DATE))))"}>}DISTINCT TOUR_START_DATE)  -- its calculate distinct count

= Count({$<TOUR_START_DATE={">=$(=Date(Today()))<=$(=Date(floor(MonthEnd(TOUR_START_DATE))))"}>} TOUR_START_DATE)  -- it calculates the no. of count incude duplicate

= Count({<TOUR_START_DATE = {">$(=Today())"}>} TOUR_START_DATE)    -- it calculate from greater than Today to end of the dates in the data model 

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.