Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
pasokaza
Contributor II
Contributor II

Calendar Measure - time range disabled

The time range is disabled and i cant create a calendar measure. How can i enable it?

Capture.PNG

 

9 Replies
lironbaram
Partner - Master III
Partner - Master III

hi 

for time range to work 

you need to tag your date field in the script as date 

the easiest way will be to use this code in your script for the relevant date 

[autoCalendar]: 
  DECLARE FIELD DEFINITION Tagged ('$date')
FIELDS
  Dual(Year($1), YearStart($1)) AS [Year] Tagged ('$axis', '$year'),
  Dual('Q'&Num(Ceil(Num(Month($1))/3)),Num(Ceil(NUM(Month($1))/3),00)) AS [Quarter] Tagged ('$quarter', '$cyclic'),
  Dual(Year($1)&'-Q'&Num(Ceil(Num(Month($1))/3)),QuarterStart($1)) AS [YearQuarter] Tagged ('$yearquarter', '$qualified'),
  Dual('Q'&Num(Ceil(Num(Month($1))/3)),QuarterStart($1)) AS [_YearQuarter] Tagged ('$yearquarter', '$hidden', '$simplified'),
  Month($1) AS [Month] Tagged ('$month', '$cyclic'),
  Dual(Year($1)&'-'&Month($1), monthstart($1)) AS [YearMonth] Tagged ('$axis', '$yearmonth', '$qualified'),
    Dual(Year($1)&'-'&Month($1), -1*monthstart($1)) AS [YearMonthsort] Tagged ('$axis', '$yearmonthsort', '$qualified'),
  Dual(Month($1), monthstart($1)) AS [_YearMonth] Tagged ('$axis', '$yearmonth', '$simplified', '$hidden'),
  Dual('W'&Num(Week($1),00), Num(Week($1),00)) AS [Week] Tagged ('$weeknumber', '$cyclic'),
  Date(Floor($1)) AS [Date] Tagged ('$axis', '$date', '$qualified'),
  Date(Floor($1), 'D') AS [_Date] Tagged ('$axis', '$date', '$hidden', '$simplified'),
  WeekDay($1) AS WeekDay,
  If (DayNumberOfYear($1) <= DayNumberOfYear(Today()), 1, 0) AS [InYTD] ,
  Year(Today())-Year($1) AS [YearsAgo] ,
  If (DayNumberOfQuarter($1) <= DayNumberOfQuarter(Today()),1,0) AS [InQTD] ,
  4*Year(Today())+Ceil(Month(Today())/3)-4*Year($1)-Ceil(Month($1)/3) AS [QuartersAgo] ,
  Ceil(Month(Today())/3)-Ceil(Month($1)/3) AS [QuarterRelNo] ,
  If(Day($1)<=Day(Today()),1,0) AS [InMTD] ,
  12*Year(Today())+Month(Today())-12*Year($1)-Month($1) AS [MonthsAgo] ,
  Month(Today())-Month($1) AS [MonthRelNo] ,
  If(WeekDay($1)<=WeekDay(Today()),1,0) AS [InWTD] ,
  (WeekStart(Today())-WeekStart($1))/7 AS [WeeksAgo] ,
  Week(Today())-Week($1) AS [WeekRelNo] ;

DERIVE FIELDS FROM FIELDS [date] USING [autoCalendar] ;
pasokaza
Contributor II
Contributor II
Author

tried to copy and paste the script but it doesn't work for me. also did add the dates source via data manager, same issue.

lironbaram
Partner - Master III
Partner - Master III

 hi

are you sure 

you have a date field that is numeric and not text 

does the date field is in the same table as the calculation field 

 

pasokaza
Contributor II
Contributor II
Author

My date field was in csv file added via data manager. Sample value "2019-01-01"

I tried to create a date field within the measure, also tried to have a separate date joining the measure. Still having same issue

RaduM
Contributor II
Contributor II

did you manage to solve this problem? i am in the same situation.

diagonjope
Partner - Creator III
Partner - Creator III

I am facing the same issue with QVFs that I have created from scratch, and also when using @Anonymous demo app (attached) in which he previously created three Calendar Measures.  The time range appears disabled / without options.  Could it be a bug in Qlik Sense April 2020?

pasokaza
Contributor II
Contributor II
Author

the issue still persist, yes i am also using april 2020 qliksense server

RaduM
Contributor II
Contributor II

I am also using April 2020 update

pasokaza
Contributor II
Contributor II
Author

This is still opened on my side, anyone has fix for this?