Qlik Community

QlikView Creating Analytics

Discussion Board for collaboration related to Creating Analytics for QlikView.

Not applicable

Need to copy to make additional selection?

Hi,

in some way this sounds simple... Probably I lack some information or understanding to solve this.

I got a data table holding sales amount values on a time axis (2000 - 2010)

I want to select two seperate years and show both amounts in the same diagram.

Do I need to copy the whole table and use different field names to show those two values in one diagram?

Regards,

Georg

Tags (1)
6 Replies
martin59
Valued Contributor II

Re. :Need to copy to make additional selection?

Hi,

You have to create a chart with two expressions :

sum(if(Year=FirstSortedValue(Year,OrderDate), OrderAmount))


sum(if(Year=FirstSortedValue(Year,-OrderDate), OrderAmount))


MVP
MVP

Need to copy to make additional selection?

I think I'm not understanding your question. It would seem to me that you'd just have, say, Year as the dimension, and sum(Amount) as the expression. It would then be showing total amounts for each of the two years in the same diagram. If you wanted to compare monthly totals for the two years, then you'd have both year and month as dimensions.

Not applicable

Need to copy to make additional selection?

I think I now have what I needed--in a way. As you said I use Year as dimension.

I then added two expressions ...

-- sum(Amount) * sum(if(Year=selected_Year1, 1, 0)

-- sum(Amount) * sum(if(Year=selected_Year2, 1, 0)

to make the diagramm show the two selected years only. But it looks abit "arount the corner" for me. Can it be done in a more elegant way?

Georg

PS: I also wonder why I must use "sum". I only have one amount per year.

MVP
MVP

Need to copy to make additional selection?

Hello Georg,

If you just want to show two years selected by user, store them into variables and use as expression something like this

Sum({< Year = {$(vYearSelectedOne), $(vYearSelectedTwo)} >} Amount)
or without variables (my guess)
Sum({< Year = {"=CONCAT(Year, ',')"} >} Amount)


Hope that helps

MVP
MVP

Need to copy to make additional selection?

Again, I may still be confused, but why do you have selected_Year1 and selected_year2? Can't you just select those two years directly in a list box on the Year field?

Not applicable

Need to copy to make additional selection?

Well, one year is slected programatically (no user selection) and the other is selected by the user. And if I use two dimensions I automatically get different color settings.

Do you think my solution is okay so far?

Community Browser