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

Show Data for last 52 weeks from current date Qliksense

Hello All ,

I have below data set :-

Dimension -'Week' & chr(10) & Week(Date)

Dimension -=If(WildMatch(Date, '*' & Year(Today())), DATE_MON)

Dimension - LOB

Measure - sum({<Monday_flag={1}, Year_trend={'$(=Max(Year_trend))'}>}TREND_VOL)

Aspiring_Developer_0-1674206798837.png

My requirement is to show data for last 52 weeks starting from current date but as the new year started it is only showing the data for a single month of Jan 2023. 

And we have created below flags to show the opening number of every week  i.e Monday :-

If(WeekDay(REPORT_DATE)='Mon' or Day(REPORT_DATE)=1, REPORT_DATE) as REPORT_DATE_MON

if(weekday(REPORT_DATE)='Mon' or Day(REPORT_DATE)=1, 1,0) as Monday_flag,

How Can I show the data for last 52 weeks considering the current month and year as well so that next time when the year changes it should not hamper the results?

Thanks in advance

 

 

 

Labels (1)
3 Replies
Aspiring_Developer
Creator III
Creator III
Author

Hello, 
Can anyone please help me on this one ?

 

Thanks

Aspiring_Developer
Creator III
Creator III
Author

Hi ,

Can anyone please help me on this one ?

Thanks

 

vinieme12
Champion III
Champion III

use the date field in your calculations as below to restrict the calculation period

 

Last 52 Weeks

=Sum({<REPORT_DATE={">=$(=WeekStart(Max(REPORT_DATE),-52))<=$(=Max(REPORT_DATE))"}>}SomeMeasure)

 

 

 

 

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