Discussion Board for collaboration related to QlikView App Development.
I have two fields year and month as text.
I want to calculate YTD for current selected Month by the user.
Thus if the user selects jan it should give sum of sales for Jan only if they select Feb they should get for Jan and feb and hence forth.
I wrote the following code:
I created a field YearMonth by converting Month into numbers and concatenating with Year.
Thus vminyearmonth is min YearMonth for any selected Month,similary vMaxYearMonth is max of YearMonth for any selected yearmonth(In this case the selected month).
But the sum I get is only for the selected month not YTD.
what is it that I am doing wrong.
Since you want YTD values, for ex. if you select Feb, you must have the sum for Jan,Feb. Since this is the intent, your vMinYearMonth should not depend on the selected month and must be fixed.
Since you haven't fixed it, when you select Feb, it selects both vMinYearMonth and vMaxYearMonth as Feb for the selected year and similarly for any other selected month.
Just add Month= in your vMinYearMonth set analysis expression.
I hope this would work.
We need variable definition too, Because vMinYearMonth need to be calculated like YearStart(Min(Year))