12 Replies Latest reply: Jun 19, 2017 12:55 PM by Aaron Wang

# Show only data from the past 7 days

I want to show data from the past 7 days only.

I currently have

sum({<Date={">=\$(WeekStart( Today()-7))<\$(=today()))"},[Customer] = >}

date([Paid in full date])

-

date([Invoice date])

) / Count( {<Date={'>=\$(WeekStart( Today()-7))'},[Customer] = >}Count)

But the above literally does nothing, its the same as if I didn't put in the time parameters. I tried testing the bottom  count(Count)

part to see if my date limitations even worked, and even just the bottom part doesn't change (17 records normally, still 17 after putting the limitation on).

Any ideas?

As you can see, the Average days to pay is the same in both scenarios. The top chart doesn't have the date limitations in the set expression.

• ###### Re: Show only data from the past 7 days

Date={">=\$(=WeekStart( Today()-7))........

• ###### Re: Show only data from the past 7 days

Also, it has been red underlined this whole time but it says expression OK at the top

• ###### Re: Show only data from the past 7 days

Try This

sum({1<Date={">=\$(=WeekStart( Today()-7))<\$(=today())"},[Customer] = >}

date([Paid in full date])

-

date([Invoice date])

) / Count( {1<Date={'>=\$(=WeekStart( Today()-7))'},[Customer] = >}Count)

• ###### Re: Show only data from the past 7 days

It didn't work says expression OK, but all the code is underlined red (it was red before as well), and no difference in the chart.

• ###### Re: Show only data from the past 7 days

try this

sum({<Date={">=\$(=WeekStart( Today()-7))<\$(=today())"},[Customer] = >}

date([Paid in full date])

-

date([Invoice date])

) / Count( {<Date={'>=\$(=WeekStart( Today()-7))'},[Customer] = >}Count)

• ###### Re: Show only data from the past 7 days

It didn't work says expression OK, but all the code is underlined red (it was before as well), and no difference in the chart.

• ###### Re: Show only data from the past 7 days

Please check your Date field name. It's name is really "Date". Looks ike this date field is not available in your model

• ###### Re: Show only data from the past 7 days

What do you mean date field? I don't have a date table in my code, I am subtracting the Paid in full date from Invoice date, both which are tables in my code

• ###### Re: Show only data from the past 7 days

Your set expression needs to reference actual fields...

sum({<[Paid in full date]={">=\$(=WeekStart( Today()-7))<\$(=today())"},[Customer] = >}

date([Paid in full date])

-

date([Invoice date])

) / Count( {<[Invoice date]={'>=\$(=WeekStart( Today()-7))'},[Customer] = >}Count)

• ###### Re: Show only data from the past 7 days

Thank you! I was confused because Qlik also has a date function, so I thought that is why you put Date there, but I guess not.

• ###### Re: Show only data from the past 7 days

This is what I wanted to tell you, but my bad

• ###### Re: Show only data from the past 7 days

No worries, thank you