Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
bobbydave
Creator III
Creator III

YTD Pie Chart

sum({<Grouping={'BUSINESS*', 'DATA CENTRE', '*INFR*', 'IT OTHER', 'IT SERVICES', 'PROJECTS'},
Breakdown={'Total YTD'}, Year={'2014'}>} [Metric Value])/sum({<Year={'2014'}>}[Metric Value])

I'm creating a pie chart that is divided into 5 groups. I want to sum their totals (YTD) and divide them by the total 2014 YTD values .

The above formula seems to be giving me between 33-36% for each grouping which is incorrect. Should be between 2% and 50% for each grouping.

Anyone spot something I've done wrong?

1 Solution

Accepted Solutions
bobbydave
Creator III
Creator III
Author

I just needed to make individual Grouping expressions.

I was trying to create 1 expression with the groupings in this expression.

Instead I created individual expressions and issue resolved.

View solution in original post

7 Replies
krishna20
Specialist II
Specialist II

Hi Dave,

Why are you using single quotes at 2014?

Regards

Krishna

bobbydave
Creator III
Creator III
Author

Noted!

I've changed them to double quotes.

Don't think this would impact the end result.

krishna20
Specialist II
Specialist II

Hi,

Create a variable for your field as vCurrentYear=Max(year).

Apply your expression like this

sum({<Year={$(vCurrentYear)},Grouping={'BUSINESS*', 'DATA CENTRE', '*INFR*', 'IT OTHER', 'IT SERVICES', 'PROJECTS'},
Breakdown={'Total YTD'}>} [Metric Value])/sum({<Year={$(vCurrentYear)}>}[Metric Value])

Regards

Krishna

bobbydave
Creator III
Creator III
Author

I get 'no data to display'.

The formula does look correct right?

I want to get a percentage of the total YTD values of each group and divide that by the total overall YTD value.

Would my formula above formulate such a result?

bobbydave
Creator III
Creator III
Author

If I create text boxes and put individual values in per group, the correct values are going in.

However if I put them in as a whole, they all come out as 100% each.

Not applicable

According to this:

bobbydave wrote:

I'm creating a pie chart that is divided into 5 groups. I want to sum their totals (YTD) and divide them by the total 2014 YTD values .

You're probably missing the Breakdown={'Total YTD'}  in the divider:

[...] /sum({<Breakdown={'Total YTD'}, Year={$(vCurrentYear)}>}[Metric Value])

bobbydave
Creator III
Creator III
Author

I just needed to make individual Grouping expressions.

I was trying to create 1 expression with the groupings in this expression.

Instead I created individual expressions and issue resolved.