17 Replies Latest reply: Mar 28, 2016 4:34 AM by Shaila Tyagi

# How to: Recent seven days by the selected day

I need to show last seven days according to the selected day.

how to do it?

Thanks

• ###### Re: How to: Recent seven days by the selected day

Hi Ariel,

Can you post a sample QVW?

• ###### Re: How to: Recent seven days by the selected day

Maybe something like this :

I have pasted that from rolling seven days Set analysis a which a Google Search for "QlikView set analysis previous 7 days" found

• ###### Re: How to: Recent seven days by the selected day

Take a look at this thread.

Set analysis sum between two given dates

There you'll find this Set Analysis example:

= sum({<OrderDate= {">=\$(=min(StartDate))<=\$(=max(EndDate))"}> } Netamountpaid)

If you change 'min(StartDate)' with 'max(EndDate)-7' you'll have a Set Analysis with a date range of 7 days. If you adjust the EndDate field with your own date-field (and off course the correct SUM field), then you'll have your 7 days according to your selection.

• ###### Re: How to: Recent seven days by the selected day

Hi Ariel,

There are a lot of ways to achieve that, it depends on what you need to do.

If you need a sum of values you can use set analysis:

=sum({<[Date field]={">=\$(=v.SelectedValueMinusSeven)<=\$(=v.SelectedValue)"}>} [Amount])

if you need to show dimention maybe using calculated dimension.

It would be great if you can share som data or elaborate more in order to help you finding the solution.

Kind regards,

• ###### Re: How to: Recent seven days by the selected day

Hi,

I think i need calculate dimension, i want to create fit X(date) by Y(sum) and control on the x-axis.

Thanks

Ariel

• ###### Re: How to: Recent seven days by the selected day

PFA

• ###### Re: How to: Recent seven days by the selected day

Thanks for the post MaxGro.

• ###### Re: How to: Recent seven days by the selected day

Hi,

Try this expression

Sum({<Year=, Quarter=, Month=, Week=, Date={‘>=\$(=Date(Max(Date)-6))<=\$(=Date(Max(Date)))’}>} Sales )

Check this link for similar expressions for various scenarios

Set Analysis for Rolling Periods

Regards,

jagan.

• ###### Re: How to: Recent seven days by the selected day

Hi,

thanks.

Not understand the syntax. i have 2 column, sDate and sMoney and i want to create fit x(sDate) by y(sMoney).

Thanks

Ariel

• ###### Re: How to: Recent seven days by the selected day

select Line chart than

Take Date as dimension

and

=sum({<Day={">=\$(=Date(Max(Day)-6))<=\$(=Date(Max(Day)))"}>} Money)  as Expression

• ###### Re: How to: Recent seven days by the selected day

hi

Try like this

Date:

Day, Value

01/01/2016, 10

02/01/2016, 20

03/01/2016, 30

04/01/2016, 40

05/01/2016, 50

06/01/2016, 60

07/01/2016, 70

08/01/2016, 80

09/01/2016, 90

10/01/2016, 10

];

Add a variable vMaxDate :=Date(Max(Date(Day))-7)  /* MaxDate*/

Sum({<Day={"\$(vMaxDate)"}>}Value)

• ###### Re: How to: Recent seven days by the selected day

Thanks, attached screen shots.

Please check, what i did wrong?

• ###### Re: How to: Recent seven days by the selected day

Add it in the Expression tab

Sum({<Day={"\$(vMaxDate)"}>}Value).

• ###### Re: How to: Recent seven days by the selected day

Select the Date you want and make sure that Date field is in proper Date format, use below expression

=sum({<Date ={">=\$(=date(max(Date)-6))<=\$(=max(Date))"}>}Amount)

• ###### Re: How to: Recent seven days by the selected day

Hi Kush141087,

I did what you are wrote, please see below. what i did wrong?

Thanks

Ariel

• ###### Re: How to: Recent seven days by the selected day

What is the Dimension & Expression you are using? If date is dimension then try below expression

=sum(aggr(rangesum(above(total sum({<Date=>}Amount),0,7)),Date))

• ###### Re: How to: Recent seven days by the selected day

Hi,

This is my data:

TimeSelection:

Period, dayS

Day, 1

Week, 7

Month, 30

Quarter, 91

HalfYear, 183

Year, 365

];

Time:

Day, Value

01/01/2016, 10

02/01/2016, 20

03/01/2016, 30

04/01/2016, 40

05/01/2016, 50

06/01/2016, 60

07/01/2016, 70

08/01/2016, 80

09/01/2016, 90

10/01/2016, 10

];

I need to create Fit XY. x=value, y= Day.

I want to choose day and Period and i want to see in the graph the day and all the period before the day.

Example:

I want to see week before 09/01/2016:

Thanks

Ariel