Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi everyone! Suppose I have this chart that shows some quantity per day.
Day | Q |
---|---|
1/8/2018 | 2 |
2/8/2018 | 5 |
3/8/2018 | 8 |
4/8/2018 | 9 |
5/8/2018 | 7 |
6/8/2018 | 1 |
7/8/2018 | 6 |
8/8/2018 | 7 |
I need to do this. Every time I choose a date, I need to compare the Q of the day selected with the Q that is recorded 7 days before.
Example
I choose 8/8/2018. Q = 7
I need to get the Q = 2 for the day 1/8/2018, so I can calculate 7-2
How can I do this? Thanks!
Something like (I didn't test):
=sum(Q) - sum({<Day={"$(=Day-7)"}>} Q)
Try
expression the last week - today
(sum({<Day={">=$(=Date(today()-7,'MM/DD/YYYY'))<=$(=Date(today(),'MM/DD/YYYY'))"}>}Q)
-
sum({<Day={">=$(=Date(today(),'MM/DD/YYYY'))<=$(=Date(today(),'MM/DD/YYYY'))"}>}Q)
)
I think this sentence "{<Day={"$(=Day-7)"}>} Q" is an "if-then" sentence that can be written like this, correct?
If(Day = "$(=Day-7)", Q)
I do not know what I'm doing wrong. The sentence works, but brings me the Q for 8/8/2018 instead of 1/8/2018...
Consider that when I select a date, the chart shows one row only. Maybe the problem resides in this fact?
Are you trying to show the difference in the chart, or in a text object?
Can you share a sample qvw?
Sure! Here you have a sample. Blue box activates when you select a date.