Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
tulasiram_bitra
Creator
Creator

week as dimension and show only last 12 weeks

Hi Frnz,

I need to show last 12 Weeks sales. Here Week as Dimension, already i have week Filed.

Please help me to write expression in Week Dimension.

1 Solution

Accepted Solutions
nagarjuna_kotha
Partner - Specialist II
Partner - Specialist II

Like this    ?

View solution in original post

7 Replies
nagarjuna_kotha
Partner - Specialist II
Partner - Specialist II

Hi Can you share sample data ?\

-Nagarjuna

marcus_sommer

You could use a condition within the dimension or the expression like:

sum({ YearWeek = {">=$(=max(YearWeek)-12)"}>} Sales)

that requires an appropriate field within a master-calendar. Possible is also to use a flag for these period. Many helpful links could you find here: How to use - Master-Calendar and Date-Values

- Marcus

Not applicable

you can use a set analysis in your expression.

SUM({<DATE_FIELD={"$(='>=' & Date(Today()-84))"}>} SALES_FIELD)

settu_periasamy
Master III
Master III

if your week field as number, may be try this..

=sum({<Week={'>=$(=max(Week,12))'}>}sales)

Not applicable

Couple of ways you can add only 12 weeks of data.

1. Add new field in the Master Calendar WeekNumber having 1, 2,3 4, 5, 6 .... for ascending week Number.

Simply add calculated dimension: IF( WeekNumber >= Max(WeekNumber)-12 , WeekNumber )

or

add to set analysis

     Sum({<WeekNumber={">=$(=Max(WeekNumber)-12<=$(=Max(WeekNumber)"}>} Sales)

2. you already have data field in your app.

IF( DateField >= max(date) - (12*7) , WeekName )

nagarjuna_kotha
Partner - Specialist II
Partner - Specialist II

Like this    ?

tulasiram_bitra
Creator
Creator
Author

Hi Frnz,

Thanks to all. Almost all expressions are useful.