7 Replies Latest reply: Sep 6, 2016 6:22 AM by Oredas Bruno RSS

    Another question about getSelectedCount

    Oredas Bruno

      Hello again,

           I think i'm addicted to this function . But i hit the wall again and looking for some help.

      I have date picker, which uses Date dimension.

      I created 2 straight tables for previous week and current week. You are able to see 7 days before selection, or any number of days after selection. Now i'm trying to calculate spend and that is where i hit do not understand the behavior.

       

      picture for qlik.png

       

       

      My original thinking was, because i determined dimensions i don;t need to put anything extra in my measure calculations, but i guess i'm wrong.

      Just in case picture is hard to understand here is my calculations for Dates for current week, previous week and spend:

       

      Current week Date:

       

      if( GetSelectedCount(Date)=0,

       

       

         if(Date >= Weekstart(Today(),0,-2) and Date <= Weekend(Today(),0,5),

            date(Date)

           )

      , date(Date)

      )

       

      Previous week Date:

       

      if( GetSelectedCount(Date)=0,

       

       

          if(Date >= Weekstart(Today(),-1,-2) and Date <= Weekend(Today(),-1,5),

          date(Date)

          )

      , date(Date)

      )

       

                    

      And i'm just using normal spend calculation:

       

      sum({<fact_type={'sales_facts'}>}sales_amount_cc) /

      sum({<fact_type={'pax_count_facts'}>} passenger_count)

       

      So sum it up, requirements given to me, i need to show only 7 days for each table, additionally user should be able to pick any date and see selection date(s) in bottom table and week before selection date(s).

       

      Any ideas and help would be much appreciated

       

      Oredas