Qlik Community

Ask a Question

App Development

Discussion board where members can learn more about Qlik Sense App Development and Usage.

Announcements
April 22, 2PM EST: Learn about GeoOperations in Qlik Sense SaaS READ MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
ShellyG
Creator
Creator

Always compare numbers to Monday

Dear all,

I will need you assistance with help and ideas on the following topic:

I have a dashboard that consists of data, which is being updated every day and therefore I have a 'Report Date' field that corresponds to the date when the report was updated. What I need to do is that I need to compare data always with Mondays.

For instance, today is Monday, so we want to see this Monday compared to previous Monday, then for tomorrow we want to see Tuesday compared to this week Monday, then Wednesday compared to this week Monday and etc...

I have some slight ideas on how to do that, but I am still struggling... I have the following for now:

vMaxDate - =max([Report Date])

vLastMonday - =date(weekstart(max([Report Date]))+1, 'DD-MMM-YYYY')

But for the second variable, I am really not sure id it will work properly... 

Could you please help me a bit with the logic here? Let me know in case more details are needed regarding what I want to do. 

Best Regards, 

Shelly 

Labels (3)
1 Solution

Accepted Solutions
GaryGiles
Specialist
Specialist

@ShellyG 

Try this for vLastMonday:

=date(WeekStart(max({1} [Report Date])-1,0,0), 'DD-MMM-YYYY')

View solution in original post

3 Replies
GaryGiles
Specialist
Specialist

@ShellyG 

Try this for vLastMonday:

=date(WeekStart(max({1} [Report Date])-1,0,0), 'DD-MMM-YYYY')

View solution in original post

ShellyG
Creator
Creator
Author

Hi Gary,

Thank you very much for your suggestion, I implemented it now and it shows me 1st of Feb, which is correct...

My only question here is, as for now I only have 1 week of historical data in my app, in one week from now this calculation is supposed to be showing the previous week Monday, correct? Meaning that if the current date is 15th of February, it will show me 8th of Feb? 

Thanks! 

Best Regards,

Shelly

GaryGiles
Specialist
Specialist

Yes.  If the max Report Date is a Monday, like 15th of February, it will return the previous Monday, 8th of February.