Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Variable fields

I am currently using a variable field to compare sales for a day.

Sum({< Inv_Date = {'$(=vDateCompare1)'}>}

How would I be able to change that value so that it includes for the full week.

All invoices from vDateCompare1 field up to vDateCompare1 + 6

Thanks

10 Replies
OmarBenSalem

If I fully understand; let's assume your variable is vToday=today() (or another date)

if it's today: 24/02/2017
you want to compare all the week or from the start of the week to today?
from 20/02/2017 to 24/02/2017?

If that's the case:
you can use 2 expressions:

actual week to date:sum(  {<   date={">= $(=WeekStart( $(vtoday) )) <= $(vtoday)"}    >} sales)

previous week to date: sum(  {<   date={">= $(=WeekStart( $(vtoday) -7) )<= $(vtoday)-7"}    >} sales)

if you want to perform comparison for the whole week:

actual week :sum(  {<   date={">= $(=WeekStart( $(vtoday) ) )<= $(=WeekEnd( $(vtoday) ))"}    >} sales)

previous week : sum(  {<   date={">= $(=WeekStart( $(vtoday) -7) )<= $(=WeekEnd( $(vtoday) -7))"}    >} sales)

Hope this will be helpfull,