Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Adding Datenum to calendar invalidates all formulas?

Hi,

I had a calendar in my QV document that was structured :

month_no_id     week_no_id     year     monthname     day     calendar_date                 week     month     quarter

201012               201052          2010     Dec               30       30/12/2010 00:00:00      52               12     1

and the formula

    =sum({$<[calendar_date]={"$(=Only([calendar_date]))"}>} [gross] )

worked to give the sales on the selected day

I added    Floor(calandar_date) tp my load script which added:

DateNum

40907

to the calendar, and now the above formula won't work.

I don't understand why - does anyone know why this is?

Much appreciated

6 Replies
avinashelite

Yes, The format is different that's why it won't work

would you please share the app

Not applicable
Author

Thanks Avinash,

The calendar is below.

I read here QlikView Addict: Dates in QlikView - Part 1 that QlikView will use the numberic value first, in this case the dateNum.

I changed the formula to this:

=Sum({<year=, month=, quarter=, week=, calendar_date=, month_no_id=, day=,week_no_id=,  dateNum={">=$(=Num(WeekStart(Max(dateNum))))<=$(=Max(dateNum))"}>} gross_sales)

but it will not work.

qlikview_calendar.png

vinieme12
Champion III
Champion III

Firstly , If you just want to show data for selected day you don't event need set analysis

The next thing is you are trying to compare a timestamp with an Integer

You either compare date with date or an integer with integer

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
vinieme12
Champion III
Champion III

You need to encapsulate the number in date () function to tell qlikview that the number is a date and then you use weekstart () on the date

=Sum({<year=, month=, quarter=, week=, calendar_date=, month_no_id=, day=,week_no_id=,  dateNum={">=$(=Num(WeekStart(date (Max(dateNum)))))<=$(=Max(dateNum))"}>} gross_sales)

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
Not applicable
Author

Thanks very much Vineeth, That is very clear. I understand now.

Not applicable
Author

Thanks very much Vineeth.

Kind regards,

Stefan