COGNOiSe.com - The IBM Cognos Community

IBM Cognos 10 Platform => Cognos 10 BI => Report Studio => Topic started by: pumccg on 11 Nov 2015 05:21:58 AM

Title: Highlight highest value in each row of a crosstab
Post by: pumccg on 11 Nov 2015 05:21:58 AM
I've looked but couldn't find solution...

Imagine a simple cross-tab using the standard Go Data Warehouse (query) sample data:

rows = Productline
columns = Years
default measure = quantity

How do I simply highlight the highest quantity value in each row?

Title: Re: Highlight highest value in each row of a crosstab
Post by: MFGF on 11 Nov 2015 05:40:19 AM
Quote from: pumccg on 11 Nov 2015 05:21:58 AM
I've looked but couldn't find solution...

Imagine a simple cross-tab using the standard Go Data Warehouse (query) sample data:

rows = Productline
columns = Years
default measure = quantity

How do I simply highlight the highest quantity value in each row?

Hi,

1. Add a query calculation to the query. Call it MaxQty, and code the expression as maximum(total([Quantity] for [Product line],[Year]) for [Product line])
2. Select the Product Line row headings, and go to the Properties property. Check the MaxQty item.
3. Select the Year column headings. Right-click, and choose "Select Member Fact Cells"
4. Press the Conditional Styles button on the toolbar.
5. Add a new Advanced Conditional Style
6. Add a new Advanced Condition - set the expression to be [Query1].[Quantity] = [Query1].[MaxQty]
7. Define the desired style for this condition.
8 Run the report.

MF.
Title: Re: Highlight highest value in each row of a crosstab
Post by: BigChris on 11 Nov 2015 05:42:02 AM
Not sure if this is necessarily the best option, but it's probably the approach I'd take. Create another data item in your query which would be

maximum([Quantity] for [ProductLine]) ... call it something like MaxQty

To use it in the conditional formatting you'll need to bring it into the report (at least that's what I've found in the past - someone please correct me if I'm wrong). I'd then create a conditional format that looks for [Quantity] = [MaxQty] and colours the cell accordingly.
Title: Re: Highlight highest value in each row of a crosstab
Post by: BigChris on 11 Nov 2015 05:43:19 AM
LOL - glad to see I'd take the same approach as the mighty muppet!
Title: Re: Highlight highest value in each row of a crosstab
Post by: MFGF on 11 Nov 2015 05:44:28 AM
Quote from: BigChris on 11 Nov 2015 05:43:19 AM
LOL - glad to see I'd take the same approach as the mighty muppet!

Lol - we even used the same name for the calculation :D
Title: Re: Highlight highest value in each row of a crosstab
Post by: pumccg on 11 Nov 2015 06:08:54 AM
Thanks heaps for these prompt replies. I'd tried something similar to both replies but couldn't get it to work. It may be because I used a Style Variable rather than Conditional Style. Off to bed now so I'll try this out tomorrow and advise.
Title: Re: Highlight highest value in each row of a crosstab
Post by: pumccg on 11 Nov 2015 04:22:25 PM
MFGF - worked a treat. Many thanks once again. My max calculation wasn't quite right, and I'd used Style Variable instead of Condition Style (since tested both and both do work).

Creating those max expressions is not one of my strong points so I'll push my luck and ask what would your max expression look like if there was nesting on the rows and edges, such as the PL with Order method Type on the rows and Year within Retailer type on the columns?