Search code examples
qlikviewqliksense

Set Analysis - Current year and previous financial periods


Trying to get the below code to run correctly, I want to get the sum of the field movement where the field GlYear is the same as what has been selected and the field GlPeriod is less than or equal to the period selected.

sum({$ <GlYear = {"{'1'} =$(=max(GlYear))"}, GlPeriod = {"{'1'} <=$(=max(GlPeriod))"}>}Movement)

I can't convert the two fields to dates as there are 16 financial periods within a year to be reviewed.


Solution

  • sum({$ <GlYear = {"$(=max(GlYear))"}, GlPeriod = {"<=$(=max(GlPeriod))"}>}Movement)
    

    I'm not sure what you are trying to achieve with the {'1'}

    My expression gives me this based on some quick test data

    enter image description here

    Tip it usually helps me figure out the set analysis by leaving the expression without a caption so that I can see the results of the $() expansion