Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for
Search instead for
Did you mean:
Contributor III

## no calculation for the last 7 days

Hello all,

I want to hide the values from the last 7 days in my chart for the Pageviews/ Quantity expression.

i tried with a simple if condition and also with set analysis, but it's not working.

sum({< Date={"<=\$(Date(max(Date)-7,'MM/DD/YYYY'))"} >} Pageviews)

/

sum({< Date={"<=\$(Date(max(Date)-7,'MM/DD/YYYY'))"} >} Quantity)

Please help!

Regards,

Andrei

1 Solution

Accepted Solutions
MVP

How about this?

Sum({<Date *= {"<=\$(=Date(max(Date)-7,'MM/DD/YYYY'))"}>} Pageviews)

/

Sum({<Date *= {"<=\$(=Date(max(Date)-7,'MM/DD/YYYY'))"}>} Quantity)

8 Replies
Master

Try this

sum({< Date={"<=\$(=Date(max(Date)-7,'MM/DD/YYYY'))"} >} Pageviews)

/

sum({< Date={"<=\$(=Date(max(Date)-7,'MM/DD/YYYY'))"} >} Quantity)

Contributor III
Author

Partially resolved.

it works, but now, the chart does not considerate the date selection.

for example, when i select april 2018, in the chart all dates will be shown, from 1 jan 2017.

I want to view only april and without last 7 days.

Thx,

A.

Master

try this

sum({< Month = {"\$=(Date(max(Date),'MM'))"}, Date={"<=\$(=Date(max(Date)-7,'MM/DD/YYYY'))"} >} Pageviews)

/

sum({< Month = {"\$=(Date(max(Date),'MM'))"}, Date={"<=\$(=Date(max(Date)-7,'MM/DD/YYYY'))"} >} Quantity)

Also let me know if you have month field or not..and what value are you getting in  =(Date(max(Date),'MM'))

Contributor III
Author

i don't have a month field.

If i need, i can create one in my script, maybe Year-month is better, because i have April 2017 and April 2018.

the value obtained is 04

Contributor III
Author

also, i want to have the option to select 2 months, not only one and to have in my chart only data from those 2 months.

i think the expression with Month will not help me

MVP

How about this?

Sum({<Date *= {"<=\$(=Date(max(Date)-7,'MM/DD/YYYY'))"}>} Pageviews)

/

Sum({<Date *= {"<=\$(=Date(max(Date)-7,'MM/DD/YYYY'))"}>} Quantity)

Contributor III
Author

it worked.

wow, that * is magical

Thanks a lot!

MVP

Indeed it is... read more about it here

Implicit Set Operators

Community Browser