Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
scott_brown
Contributor III
Contributor III

Compare two date ranges

I am trying to find a way to compare two different date ranges. For example, i need to have two columns in the same table for sum(sales), one containing DateRange1 and the other containing DateRange2, with the user being able to select which date ranges they want to compare. My date field is WeekEnding date, so i have one sales value for each week ending date.

I've created an alternate state 'CompareDate' and created a second WE_DATE listbox with the new alternate state, and an expression sum({CompareDate}Sales),  however I need the remaining listbox filters to also apply to the same column.

Labels (3)
1 Solution

Accepted Solutions
scott_brown
Contributor III
Contributor III
Author

UPDATE: I ended up adding WE_DATE2 to the load script, taking values from the resident table where WE_DATE resides and creating a column with the expression: sum({$<WE_DATE=P(WE_Date2)>}Sales).

View solution in original post

3 Replies
vamsee
Specialist
Specialist

If I got your question right, I would suggest you use Alternate States .

Let's say you create two list boxes for [WeekEnding Date], one in Time1, other in Time2.

Create a chart with two expressions 

1. Sum({Time1}Sales)

2. Sum({Time2}Sales)

 

Also refer Qlikfix Alternate-states

scott_brown
Contributor III
Contributor III
Author

Hi Vamsee,

I've created an alternate state 'CompareDate' and created a second WE_DATE listbox with the new alternate state, and an expression sum({CompareDate}Sales),  however I need the remaining listbox filters with the default state to also apply to the same column. Hope that makes sense

scott_brown
Contributor III
Contributor III
Author

UPDATE: I ended up adding WE_DATE2 to the load script, taking values from the resident table where WE_DATE resides and creating a column with the expression: sum({$<WE_DATE=P(WE_Date2)>}Sales).