2 Replies Latest reply: Jul 22, 2016 3:49 AM by Stephane PAGLIONE RSS

    Set analysis and alternate State

      Hello I am new in QlikSense and I need your help ;-)


      I have Products, Sales and a Calendar on SalesDate

      I need a table to show product Name,sku,brand,..., sales on a period, Sales on the same period previous year


      The criteria on calendar's fields should not filter my selection ! in fact if I choose year  2016, i want to see in my table products sold in 2015 too


      So i have create an alternate state [SelDate] and assign "the Date Selection" to this Alternate State.


      I've created a new measure like this : sum({<[Year]={$(=Max([Year])-1)}>} [Sales.Qty]*[Sales.Price]) , it's ok --> if have the amount for 2015 because i have no selection on date, so the max date = 2016 - 1 = 2015.


      So i want to to have the max date from my alternate state :

      Sum({<[Year]={$(=Max([SelDate]::[Year])-1)}>} [Sales.Qty]*[Sales.Price]) 

      but it's return 0. Syntax problem ?

      My final goal it's to create a variable with one argument, like this variable for my alternate state :

      $(vClearCalendar), [Year] = {$(=Max([Year])-$1)}, [_DaySerialYear] = {"<=$(=Max([_DaySerialYear])) >=$(=Min([_DaySerialYear]))"}


      _DaySerialYear is a field added in the calendar = Month *100 + Day to manage correctly 29th of February.

      vClearCalendar is another variable to reset all calendar criteria ='['& Concat(distinct {1<$Table={'Calendrier'}>}$Field, ']=, [')&']='

      Someone can help me solve my problem ?


      Thanks in advance,

      Best regards,