Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
[View:http://community.qlik.com/cfs-file.ashx/__key/CommunityServer.Components.UserFiles/00.00.02.89.41/Set-Analysis-to-compare-time-periods.qvw]
Hi Guys,
Please take a look at the qvw attached.
I have two set of field to select a time period (year, quarter, month).
The first one, being the current selections for the whole model.
The second one, should help me to compare data from different time periods in the table.
For example,
Get the Qty and Turnover for Jan-2011 compare to Qty and Turnover Mar-2010.
where DateKey is the date for current selection, and DateKey2 is the selections to compare the second set.
I though than I can use set analysis in the columns of the second set (last two columns in the table), using ...{ <DateKey = { P(DateKey2) }>}..
But that is not possible because both datekey fields has different selections: Jan-2011 and Mar-2010.
How can I work it around?
Thanks in advance,
Aldo.
Aldo, I think you would only have to clear the current selections to get the outcome you are expecting, like this:
=Sum( {<DateKey = P(DateKey2),Month=, Quarter=,Year=, Last3Years=, YM=>} Invoices.TQuant)
Hope this helps.
Best Regards
Aldo, I think you would only have to clear the current selections to get the outcome you are expecting, like this:
=Sum( {<DateKey = P(DateKey2),Month=, Quarter=,Year=, Last3Years=, YM=>} Invoices.TQuant)
Hope this helps.
Best Regards
Hi Ivan, thanks for answering.
I'll try it and let you know.
What's the meaning of
Month=, Quarter=,Year=, Last3Years=, YM=>} ?
Thanks,
Aldo.
You are cleaning the user selections up. For instance, if the user selected year 2011, you can artificially clear that selection within the set analysis by doing:
sum({$<Year =>}1)
In this particular situation it is safer to clear every current calendar selection, so that it will not mess with the comparision calendar dates.
Regards
Hi llauses, I think that by using the "1" qualifier within the set analysis you are overlimitating the power of the user to make selections, by doing that you are forcing to evaluate the expression with the whole set of data disregarding user selections, meaning that if the user selects a family or anything else he will always see the same result. I guess, after all, it all depends on the business requirement.
Regards