2 Replies Latest reply: Mar 1, 2018 8:31 AM by Sean Lewis RSS

    Qlik Sense "if" statement indicating no filters have been applied

    Sean Lewis

      Hello, all.

       

      I'm hoping someone can help me with my following chart expression:

       

      if(isnull([Capacity_Date.autoCalendar.Year]),

      Sum( { $< [Capacity_Date.autoCalendar.InYTD]={1}, [Capacity_Date.autoCalendar.YearsAgo]={1} > } [Deliverables] ) -

      Sum( { $< [Capacity_Date.autoCalendar.MonthRelNo]={0}, [Capacity_Date.autoCalendar.YearsAgo]={1} > } [Deliverables] ), Sum({<Cap_Year={2017}>}Deliverables))

       

      What I'm trying to achieve is to show a YTD value for the previous year if no filters are applied - when filters are applied, I want to see the appropriate values corresponding to the filter selections.  This is being displayed in a KPI with 2 measures - the other measure shows CY YTD if no filters are applied and appropriate values corresponding to the filter selections when the filters are used.  Now, this does work, for the most part.  The problem is that when I select months, quarters, etc. spanning years, the values from the 2 KPIs default back to their YTD values. 

       

      Is there a better way to write my initial "if" statement?  I'm using calendar measures to define my date filters and my set analysis expressions but am open to writing these expressions differently.

       

      Thanks!