Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
profilejamesbond

Yearly Sales Data comparison by Calendar Week

Hi,

I want to compare yearly data by calendar week.

Here is the sales data (input):

Year Week Sales
2022 1 1001
2022 2 3003
2022 3 5252
2023 1 1234
2023 2 2345
2023 3 3456

 

Here is the output that I need:

Week Sales (2022) Sales (2023)
1 1001 1234
2 3003 2345
3 5252 3456

 

Please remember: I have master calendar with year and week. I need only static table. I mean when I select year or week it doesn't reflect to the output table. The output table must be constant forever.

I want to write expression for that problem.

Thanks

Labels (6)
2 Solutions

Accepted Solutions
profilejamesbond
Author

Hi @its_rajvir,

Pivot table is not an option.

I have to deliver in straight table (Qlik Sense).

Thanks

View solution in original post

profilejamesbond
Author

Sum ({<Year = {$(=Max({<Year=>} Year))}, Week=>}Sales)

View solution in original post

5 Replies
Vegar
MVP
MVP

What about creating a pivot table using [Week] as your row dimension, [Year] as your column dimension and the following expression as your measure?

=sum({$<[Year]=,[Week]=>}Sales)

its_rajvir
Creator
Creator

profilejamesbond
Author

Hi @Vegar,

Pivot table is not an option. I have to make it in straight table.

If I use your expressiion then I'll see the sales of 2022 and 2023 together.

Thanks

profilejamesbond
Author

Hi @its_rajvir,

Pivot table is not an option.

I have to deliver in straight table (Qlik Sense).

Thanks

profilejamesbond
Author

Sum ({<Year = {$(=Max({<Year=>} Year))}, Week=>}Sales)