Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
Charts using aggregation on the Y value series and not aggregated value on the X-axis
mogwai
<p>Often I want to create a chart based on a grouped table. My example is a table with:</p>
<p>state</p>
<p>happyCustomers</p>
<p>unappyCustomers</p>
<p> </p>
<p>I group it by state and I want to chart the percentage happy customers</p>
<p> </p>
<p>I create aggregation at group level for:</p>
<p>groupHappy = sum(happyCustomers)</p>
<p>groupTotalCustomers=sum(happyCustomers + unhappyCustomers)</p>
<p> </p>
<p>and a data item groupPercentHappy = groupHappy / groupTotalCustomers</p>
<p> </p>
<p>Now I want a bar chart that shows the percentage hapy customers per state. The problem is that the state name on the X-axis is at the table detail level and not at the same group level as the calculated groupTotalCustomers. It would be easy if I could do the aggregation in the chart, but because I am calculating a ratio of sums this won't work.</p>
<p> </p>
<p>I usually solve this by adding an aggregated field at group level:</p>
<p>stateName = FIRST(State)</p>
<p>And put this on the X-axis</p>
<p> </p>
<p>Although this works, I was wondering if there isn't a cleaner way to do this. If I simply add the dataset rrow State to the table's group header, it does this for me automatically in the table without requiring aggregation. If I put dataset row or (table) row state on the X-axis, it disaggregates and gives me a bar for every detail row in the table.</p>
<p> </p>
Find more posts tagged with
Comments
There are no comments yet