Qlik Community

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
Support Case Portal has moved to Qlik Community! Read the FAQs to start exploring Support resources.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Dynamic Dimensions - Changes Based on Current Selection

I have a client that would like display the count of Customers that purchased a hearing aid in the currently selected year and when their last purchase as using a "Years From" dimension:

YearsFromStraightTable.png

If customer, A, purchased a hearing aid in 2008 and customer, B, purchased in 2010 with the year 2013 is selected from the QV app master calendar, the "Years From" dimension would have "5 years" and "3 years" because 2013-2008 = 5 and 2013-2010 = 3. The expression in the straight table is Number of Customers = Count(DISTINCT CustomerID) per dimension. 

But if the user selects 2014, those dimension values change to "+5 years" and "4 years".

I have not yet been able to find out how to have the "Years From" dimension dynamically change based on the Year selected. Attached is a sample app.

4 Replies
Nicole-Smith

How about the Years From (New) chart in the attached .qvw file?

Not applicable
Author

Unfortunately that QVW doesn't work for this issue. The CustomerID values cannot be in the straight table. This is a table summing up the # of Customers per "Years From" value. "Years From" should be the dimension but I can't get that expression to become a dimension.

In your example, it still only takes the first "Years From" value and doesn't display all values.

bill_markham
Champion III
Champion III

Mark

Would a Calculated Dimension like this help ?

= if ( (GetFieldSelections(Year) - PurchaseYear)  > 0 ,

If( (GetFieldSelections(Year) - PurchaseYear)  >5 ,

'+5 years', (GetFieldSelections(Year) - PurchaseYear) )

, null() )

See attached sample.

I used a Pivot Table object so I could see the underlying data, you can change it to whatever object type you wish.  Also on the Year List Box I have set it to Always One Selected Value.

Best Regards,     Bill

Nicole-Smith

Hi Mark,

Please check out the attached.  I think it gives you what you're looking for.