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

Set analysis to display static graph

Can someone help me with this?

I need to be able to see from current week, 2 weeks of actual sales and historical forecast and 4 weeks of future forecast. In my example,

Current week  in the application is 10/6/2014.

I need to see sales and historical forecast for: 9/29/2014, 9/22/2014

I need to see future forecast for: 10/6/2014, 10/13/2014, 10/20/2014, 10/27/2014

How can I make this happen? Attached is QVW file and data.

1 Solution

Accepted Solutions
wms_manis
Partner - Contributor III
Partner - Contributor III

You needed the set expression on all the sum values.

sum({$< calendar_week = {">=$(=weekStart(snapshot_week,-2))<=$(=weekStart(snapshot_week,4))"}>} actual_sales)

sum({$< calendar_week = {">=$(=weekStart(snapshot_week,-2))<=$(=weekStart(snapshot_week,4))"}>}forecast_2)

I modified your file and attached it.

Hope it helps.

Wade

View solution in original post

4 Replies
wms_manis
Partner - Contributor III
Partner - Contributor III

You needed the set expression on all the sum values.

sum({$< calendar_week = {">=$(=weekStart(snapshot_week,-2))<=$(=weekStart(snapshot_week,4))"}>} actual_sales)

sum({$< calendar_week = {">=$(=weekStart(snapshot_week,-2))<=$(=weekStart(snapshot_week,4))"}>}forecast_2)

I modified your file and attached it.

Hope it helps.

Wade

Not applicable
Author

Wade, this is wonderful.

One question though. This works perfectly in my sample application. When I do it in my actual application, it gives me more than than 2 weeks for sales ( 7 weeks to be exact). Do you know why?

This is the script that I'm using:

sum({$< calendar_week = {">=$(=weekStart(snapshot_week,-2))<=$(=weekStart(snapshot_week,4))"}>} sales)

Does it matter if my dates are in weeknumber/year format or a monday date format?

wms_manis
Partner - Contributor III
Partner - Contributor III

The date comparison is using the date value format.

One trick you can use to see how the expression is evaluated is to change the chart type to a Straight table and then remove the label.  Now when you hover over the label, you can see how the set expression is being evaluated.

You may need to use Max(snapshot_week) if that has multiple values.  Using max will not force you to set that field to only one selected.

jagan
Luminary Alumni
Luminary Alumni

Hi,

Try like this

Give this in Text object and check whether calendar_week  and the below expression value are in same format, if both are in different format then your expression won't work.

weekStart(snapshot_week,4)


For set analysis date format should be same otherwise it gives invalid results.


If you have multiple snapshot_week then use


sum({$< calendar_week = {">=$(=weekStart(Max(snapshot_week),-2))<=$(=weekStart(Max(snapshot_week),4))"}>} sales)


Regards,

Jagan.