Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Oliver_F
Partner - Creator III
Partner - Creator III

Choose Previous Year Value based on Actual Year Indicator

Hi,

I have a List of Data for

- Dimension: A, B

- Year: 2016-2018

- Month: 1-12

- Indicator: yes, no

- Value

What I want to have is a sum(value) for 2017 & 2018 that uses this logic: if the indiciator of the actual year month is yes use the value of the previous year month.

E.g. if 2017 April indicator is yes, include April 2016 into the sum for 2017

E.g. if 2018 May indicator is no, do not include 2017 May in the sum for 2018

I created a Table with two columens: Dimension, Expression.

I used this expression for testing (only valid for 2017 as 2016 is hard coded for now):

=sum(

aggr(

    if(only(indicator) = 'yes'

        ,

            sum(

            {<

                year = {2016}

                >}

            value)

        )

    ,dimension,year,month)

)



I somehow know why it does not work, but I don't know how to fix it. Do you have any idea?

0 Replies