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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
pal25
Contributor III
Contributor III

Weekday function giving 0 output, can any one help identifying the error ?

Hi,

My formula is like this - SUM({<Weekday={"$(=Weekday(Max(Date)))"}>}Value)

The one in orange are data fields, while the one in blue are Qlik functions.  My value field is available in the data for each weekday ( Mon to Sun). I want to pull the value for the Weekday which matches the Weekday of the latest available date in the data. 

When i replace my code which is underlined by a name such as 'Monday', then formula given correct output. But the above mentioned isnt working as i have to make it dynamic based on the latest weekday

Can someone help where is the error and how to solve it 

 

 

2 Replies
Alan_Slaughter
Support
Support

Hi Pal25,

Suggestion 1: A thought - cast the  max(date) back to a date format, like date(max(date))?

Suggestions 2 : 

Weekday function is 0 based.

https://help.qlik.com/en-US/sense/May2022/Subsystems/Hub/Content/Sense_Hub/Scripting/DateAndTimeFunc...

Suggestions 3: I believe if you add “total” as:  Weekday(Max(Total Date)) you should get what you specified. I think it’s considering each date individually without it.

 

vinieme12
Champion III
Champion III

Weekday() returns a dual value  ie  'Mon' and 0; it does not return 'Monday'

So if your Weekday field has values like 'Monday','Tuesday'    then it will NOT match with 'Mon' or 'Tue'

I suggest you recreate your Weekday field or create a new Weekday field using the weekday() function

 

 

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