Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
gauravgg
Partner - Creator
Partner - Creator

Convert to set analysis

Hi

I want to convert the following expression in to set analysis

Sum(If( Aggr(nodistinct Min(Datetime), BusinessID) = Datetime, OpeningBalance))

15 Replies
jonathandienst
Partner - Champion III
Partner - Champion III

This may not be suitable for set analysis - you will still need to loop over all the BusinessID values to determine the minimum date so the performance may not be a lot better than the Aggr(). This better done with a flag value derived in the load script.

Map_MinDates:

Mapping LOAD BusinessID,

    Min(DateTime) as MinDateTime

Resident Data

Group By BusinessID;

Join(Data)

LOAD BusinessID,

     Datetime,

     if(Datetime = ApplyMap('Map_MinDates', BusinessID), 1, 0) as MinDateFlag

Resident Data;

Then the expression becomes:

Sum({<MinDateFlag = {1}> OpeningBalance)

Change the tablename above (Data) to the correct name for your model.

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
gauravgg
Partner - Creator
Partner - Creator
Author

hi

Thanks for the reply

But is it possible using set analysis only, can you help me ?

Thanks in advance

Anil_Babu_Samineni

Try this,


I don't think whether nodistinct require for you


Aggr(Sum({<Datetime = {'$(=Min(Datetime))'}>}OpeningBalance),BusinessID)


We can help you if you provide data / application

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
jonathandienst
Partner - Champion III
Partner - Champion III

I don't think it can be done practically using set analysis, but I would be interested to see if anyone can prove me wrong. And even if it is possible, it will be complex and unlikely to perform materially better than a sum(if())

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
PrashantSangle

Hi,

As you know set analysis evaluate set on chart level not on row level, there fore even if we convert it into set analysis still it not going work properly.

So i think jonathan suggestion is perfect solution for you.

Regards,

Prashant

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
jonathandienst
Partner - Champion III
Partner - Champion III

Anil

The Min(Datetime) in that set expression is the minimum for all BusinessID's. I think the requirement is for the Min(Datetime) be the earliest Datetime for each BusinessID.

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
Anil_Babu_Samineni

Let him explain more. I got his intention. That'f for i liked it your first reply. Anyhow, we can try different way if he prove himself or else we can suggest him as your first response

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
gauravgg
Partner - Creator
Partner - Creator
Author

hi

Jonathan , your reply was helpful

But i have a qliksense qvf in which i have a Binary load data model , i cannot make changes in data load editor .

So , i am trying to do it on the presentation layer

gauravgg
Partner - Creator
Partner - Creator
Author

hi

I tried this , but it is not giving me the value