Cognos Analytics

 View Only

 Percentage in dashboard

  • IBMChampion
Veljko's profile image
Veljko posted Thu March 06, 2025 04:08 AM

I have measure which is count distinct - Number of stores, and Dimension - City. City is on dashboard, and it is possible to choose it. I want to create a % calculation that will calculate percentage for measure (number of stores) for chosen city in total number of stores. How?

Robert Dostal's profile image
Robert Dostal IBM Champion

Hi Veljko,

for those purposes there's the "for" clause in calculations. It determines the aggregation level for the calculation.

I created a small sample based on IBM sample data Great Outdoors. count( distinct City) and count (distinct City for Region). Then a third calculation for the percentage.

 That's the result:

You would nedd a count( distinct Stores for City) in your data.

Hope this helps.

Veljko's profile image
Veljko

Hi Robert,

Thank you for your replay.

First problem is that I can't get this editor like you for calculation. Mine looks like this 

Robert Dostal's profile image
Robert Dostal IBM Champion

Hi Veljko,

you can open the calculation editor by using the context menu (right click) on folders or tables:

Or you click the link on the bottom left of the screen here:

Veljko's profile image
Veljko

Yes, I have done like that at first, but since I always was getting 1 as a result for a % calculation, I thought that maybe the problem is with editor :)

I am using DMR, since at your example is a relation model, maybe that is a problem? Also, I am trying to show this calculation at visualization where city is changed dynamically.  

Robert Dostal's profile image
Robert Dostal IBM Champion

Ah! DMR - way more easy than thought. What you need is a completeTuple + currentMember(<Hierarchy>). 

I created a sample based on the IBM GO Dynamic Cubes sample cube. Just create the complete tuple and then use it to calculate the percentage of your count distinct measure to this tuple:

In this example I would like to have the value of the count distinct measure in the combination of the dynamically assigned time and region. All other hierarchies the "All" or default member is used.

Works:

The only down side is that count distinct measures of DCs are not supported in summaries of tables. Don't know if that also applies to DMR but if you use charts - all is good.

Veljko's profile image
Veljko

It works perfect. Thank you very much Robert :)