COGNOiSe.com - The IBM Cognos Community

IBM Cognos 10 Platform => Cognos 10 BI => Report Studio => Topic started by: cognos05 on 02 Feb 2015 10:35:38 AM

Title: Sorting parent based on childrens total sales
Post by: cognos05 on 02 Feb 2015 10:35:38 AM
Hi ,

I have an issue in sorting in dimensional reporting.

Reps and Accounts nested in rows.

A rep might have N accounts and columns showing total sales on each account for few products.

I would like to sort my reps first based on the highest sales of accounts within them.


I am using this expression on my rep data item as

order(Reps, Total,Desc).  Where total is dataitem with expression total(currentMeasure within set([A],);

I am not getting any error,but my reps are not sorted based on their childrens ie Accounts sales total.

Any help is appreciated.

Thanks,
Nithya



Title: Re: Sorting parent based on childrens total sales
Post by: cognos05 on 02 Feb 2015 11:07:02 AM
Hi,

I was able to get in to the issue.

my sorting should have a condition tuple( Qty, [time])
where [time] would return a set .
I cannot use a set inside a tuple, so I had done this below.

order(reps,aggregate(qty within set ([time])Desc).
I have products shown using prompts on the report which I dont include in the above data item.May be this is causing the issue.

If I need to include it ,how should my expression be.

Thanks,
Nithya

Title: Re: Sorting parent based on childrens total sales
Post by: MFGF on 02 Feb 2015 11:25:34 AM
Quote from: nithya1224 on 02 Feb 2015 11:07:02 AM
Hi,

I was able to get in to the issue.

my sorting should have a condition tuple( Qty, [time])
where [time] would return a set .
I cannot use a set inside a tuple, so I had done this below.

order(reps,aggregate(qty within set ([time])Desc).
I have products shown using prompts on the report which I dont include in the above data item.May be this is causing the issue.

If I need to include it ,how should my expression be.

Thanks,
Nithya

Is your prompt returning a single product member or a set of product members?

MF.
Title: Re: Sorting parent based on childrens total sales
Post by: cognos05 on 02 Feb 2015 11:45:18 AM
No it was taking products in to consideration.My mistake,  I just figured out whats happening.

I have Rep and he has accounts nested.

Now the expression on rep was order(reps,aggregate(qty within set ([time]),Desc). . This sorts perfectly.
Next expression on the nested account.  I am doing a filter on this guy to show only the inactive accounts.
Expression on Account data item is filter(Accounts,"Only InActive")

so logically it works correct. but is there a way for me to say sort the reps based on desc qty but do only include their childrens whos accounts are inactive.

Thanks,
Nithya