Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Simple set analysis question

Hello all,

I have a simple Set Analysis question. I just cant get it to work and im getting nuts   See the code below:

This works!

=sum

(

    {

        $<

            Year={$(=max(Year))},

            [Year Month]={$(=num(max([Year Month])))}

        >

    }

VALUE

)

This does not work!

=sum(

{

    $<

    Year=,

    [Year Month]={"$(=max([Year Month]-1))"}   

    >

}

VALUE

)

Im trying to compare a value with the value last month. Could anyone give me a suggestion for how to do this?

The field [Year Month] has the value = "200101".

Br

c

2 Replies
jagan
Luminary Alumni
Luminary Alumni

Hi,

You [Year Month] field has the value = "200101", when you subtract -1 then you get 200100, 0th month, this(200100) does not exists in your month field, so your expression is not returning any results.

If you have a date field then you can try this

=sum(
{
    $<
    Year=,
    [Year Month]={"$(=Date(Addmonths(max(DateField), -1)), 'YYYYMM')"}   
    >
}
VALUE
)

Hope this helps you.

Regards,

Jagan.

thomas_skariah
Creator III
Creator III

Hi Cristain,

You can get an idea from the below attached application.

Regards,

Tom