Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
schmidtj
Creator II
Creator II

SET Analysis Question

Hi,

i have a question referring to SET ANALYSIS.

I have a bar chart with a dimension for calendar weeks on the x-axis.

As a KPI on the y-axis i would like to show a sum of items per calendar week.

An item has furthermore a property called 'informed', which is also a calendar week.

Now, i would like to count only those items, where the calendar week 'informed' matches the week on the x-axis.

I tried the following but its not working.

Count

(

     {

         $<       

            property_1                   = {1},           

            property_2                  -= {19,9,25},

            property_informed       = [calendar_week]

           >   

     }   

     distinct item_id

)

Cal somebody give me some advice?

Basically i would like to compare datafields with datafields in SET analysis.

1 Solution

Accepted Solutions
jduarte12
Partner - Creator II
Partner - Creator II

One way that might work is creating a condition when you load the script. Something like:

Load

...

property_informed

...

if(property_informed=calendar_week,1,0) as property_info

And then, in the set analysis expression:

Count

(

    {

        $<    

            property_1                  = {1},        

            property_2                  -= {19,9,25},

            property_info      = {1}

          >

    }

    distinct item_id

)

View solution in original post

6 Replies
jduarte12
Partner - Creator II
Partner - Creator II

Hi,

Please check that property_informed and calendar_week are in the same date format.

schmidtj
Creator II
Creator II
Author

It is both a number value, e.g. 201732.

jduarte12
Partner - Creator II
Partner - Creator II

One way that might work is creating a condition when you load the script. Something like:

Load

...

property_informed

...

if(property_informed=calendar_week,1,0) as property_info

And then, in the set analysis expression:

Count

(

    {

        $<    

            property_1                  = {1},        

            property_2                  -= {19,9,25},

            property_info      = {1}

          >

    }

    distinct item_id

)

vinieme12
Champion III
Champion III

please post some sample data and expected output

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
schmidtj
Creator II
Creator II
Author

Ok thats one way to go - works for me, thanks.

sunny_talwar

One other way without modifying the script would be like this

Count

(

    {

        $<  

            property_1                  = {1},      

            property_2                  -= {19,9,25},

           item_id                        = {"=property_informed = [calendar_week]"}

          >

    }

    distinct item_id

)