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: 
paulyeo11
Master
Master

How to Create calendar measure

Hi All

I have this QVF file , which i like to learn how to Create calendar measure , Hope some one can advise me how to do this ? As i try i keep get error msg " No data field detected....

What i did is ( After view the you tube demo ) :-

Step 1 I click on Field icon , which is lower of 4 icon.

Step 2 I go to search box , enter " sales "

Step 3 I click use mouse right click on " sales " Create calendar measure

Step 4 I see the error msg came out " No data field detected....

Paul Yeo

14 Replies
Michael_Tarallo
Employee
Employee

Hi Paul -

It works for me - see attached apps - App2 - binary loads from App1 - and then uses this code:

Binary 'lib://DataFolder/app1.qvf';

    [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(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'), 

      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 [OrderDate] USING [autoCalendar] ; 

I think the problem might be with the "date" field  name - date is a keyword, I don't think you should use that name, you might need to change it.

Note my field name grabbing data from app1 is OrderDate

Regards,
Mike Tarallo
Qlik
paulyeo11
Master
Master
Author

Hi Michael

In my QVW file the master calendar script as below , So i should use TempDate instead of date right ? But i just try it should not work. By the way your app1.QVF , i also cannot find the field name with Calendar 12 icon , But for your app2.qvf i found the OrderDate field , have the Calendar 12 icon.

MasterCalendar:

LOAD TempDate AS date,

  D AS link_Date,

  D AS Date,

  day([TempDate]) as [day],

  day(D) AS Day,

//////////////////////////////////// Week

// Week([TempDate]) as Week,

  week(D) AS Week,

  weekday(D + 2) AS Weekday,

  dual(week([TempDate])&'-'&weekyear([TempDate]),weekstart([TempDate])) as YearWeek,

paulyeo11
Master
Master
Author

Hi Michael

Now it work. I need to go to my load script on sales order table add a field name OrderDate. I can not use the master island calendar Date field , it will not work.

Thank you very much for you help.

Paul Yeo

DIrector

TDS Technology (S) P/L

Whatsapp +65 9326 1804

www.tdstech.com<http://www.tdstech.com>

johndoub
Contributor III
Contributor III

can i create a calendar measure for sum(sales) for today's date?

johndoub
Contributor III
Contributor III

i am trying to create a calendar measure for my date field BUS_DT which will sum the sales for TODAY.

is that possible?

 

john doub