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: 
Not applicable

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.same2.png

1 Solution

Accepted Solutions
dwforest
Specialist II
Specialist II

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)

View solution in original post

12 Replies
antoniotiman
Master III
Master III

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

aarkay29
Specialist
Specialist

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)

Not applicable
Author

sadly didn't work code.png

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

Kushal_Chawda

try this

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

date([Paid in full date])

-

date([Invoice date])

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

Not applicable
Author

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.

Not applicable
Author

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.

Kushal_Chawda

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

Not applicable
Author

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

dwforest
Specialist II
Specialist II

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)