Skip to main content

New to Qlik Sense

If you’re new to Qlik Sense, start with this Discussion Board and get up-to-speed quickly.

Announcements
QlikWorld 2023, a live, in-person thrill ride. Save $300 before February 6: REGISTER NOW!
cancel
Showing results for 
Search instead for 
Did you mean: 
Chinnu3
Contributor III
Contributor III

How to create the last 12 weeks in 2021 year

I have "report date" column which has the dates from 2019 to till present , but i want show only entire 2020 data as Monthly dimension and I want to show weekly data in dimension and 30 days of Dec as dimension.

In script only I want to create these Columns to use in entire dashboard.

Like Column-"Month" (it should show only 12 months of 2020)

         Column-"last 12 weeks in 2020"(it should show Oct Nov Dec weeks data)

        Column-"30days in 2020"(It should show Entire Dec Dates)

Report Date
1/1/2019
1/2/2019
1/3/2019
1/4/2019
2/5/2019
1/6/2020
2/7/2020
3/8/2020
4/9/2020
5/10/2020
6/11/2020
7/12/2020
8/13/2020
9/14/2020
10/15/2020
11/16/2020
21/17/2020
2/18/2021
4/19/2021

 

Thanks In advance. 

Labels (2)
2 Replies
anthonyj
Creator III
Creator III

Hi @Chinnu3 ,

You can create the columns you're after in the load script with an "if" condition.

For example:

if([Report Date] >= '01/01/2020' and [Report Date] < '01/01/2021',  date(monthstart([Report Date]),'MM/YYYY' )  as [Report Month],

if(match(month([Report Date]), 10,11,12 ) and year([Report Date]) = 2020, week([Report Date]) ) as [Oct-Dec 2020]

if( month([Report Date]) = 12 and year([Report Date]) = 2020, [Report Date]) as [Dec 2020]

Regards

Anthony

Chinnu3
Contributor III
Contributor III
Author

Thanks for you response