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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
Maddineni_S
Contributor III
Contributor III

max 3 weeks need to fetch

From the below table date column i am trying to pick max 4 weeks. date column has till today. i want max 3 weeks numbers . 1 ,52,51. but  am getting 52,51,50. can anyone help me to get it.

 

Maddineni_S_1-1672844783827.png

 

Labels (4)
3 Replies
SerhanKaraer
Creator III
Creator III

Hello Maddineni,

It is unclear whether you try to get it in script or in chart.

However, you can do it in a chart by applying filter as below:

 

=aggr(NODISTINCT RowNo(),(wk2,(=Min(Date),DESC))) <= 3

 

You sort wk2 values by Min(Date) in descending order and then start enumerating wk2 values from 1 with RowNo.

I hope it resolves your problem.

QFabian
MVP
MVP

Hi @Maddineni_S , yo can create the week name from the date, there is a weekname function, that give you year and week number, and with that you can avoid your problem.

https://help.qlik.com/en-US/cloud-services/Subsystems/Hub/Content/Sense_Hub/Scripting/DateAndTimeFun...

 

Function Week gives just the week.

Greetings!! Fabián Quezada (QFabian)
did it work for you? give like and mark the solution as accepted.
Maddineni_S
Contributor III
Contributor III
Author

I am trying to create a variable in front end