7 Replies Latest reply on Oct 17, 2016 9:48 AM by paolo.raia

# Calculate percentage of aggregated week values

Hi there,

I have a set of data which looks something like this:-

The calculation to produce the compliant/non-compliant values is as follows:-

What I would like to do is simply create a pie-chart to create a % of the two values: COMPLAINT/NON-COMPLIANT.

So the representation would be:

Non-Complaint 30.77%

Compliant 69.23%

• ###### 1. Re: Calculate percentage of aggregated week values

You should try something like this. Just select the chart from the marks to pie. Then drag your [Records Completed] measures on angle. Then drag [compliant/non-compliant] on color marks. Final step to get the % of total then use table calculation to percentage of total.

As for e.g; Using superstore data.

Hope this help.

Mahfooj

• ###### 2. Re: Calculate percentage of aggregated week values

Hi ,

I have implemented this with the exact data what you mentioned in your Question.

Create a calculation like below

IF [Records Completed]>=800 THEN "Complaint" ELSE "Non-Complaint" END

i named this calculation cat , drag this calculation into color shelf and change your chart type to Pie and then drag Number of Records from measures into Angle shelf in Marks card. Create a table calculation on the Number of Records in Marks card as Percent of Total and drag the same into Label shelf also.

• ###### 3. Re: Calculate percentage of aggregated week values

Many thanks Mahfooj and Hima for your replies.

Unfortunately, your examples do not work for me as I should have explained this a little better.

As a further example, I am working with this data-set:-

The calculation has to firstly summarize the data by week number (anything under 800 is not compliant):-

The pie-chart will then show a result of % of days which are/are not compliant :-

Sorry for the confusion and thanks again for your help.

Regards.

• ###### 4. Re: Calculate percentage of aggregated week values

You can use a LOD function to check the compliance at the week level using { FIXED  [Week No] : SUM([Records])}.

This can be followed by pie chart a distinct count of weeks for each category - compliance and non-compliance.

Find attached a workbook with these calculations. Hope this helps.

• ###### 5. Re: Calculate percentage of aggregated week values

Hi Dinesh,

Yes, that's exactly what I was looking for!  I have used LOD once before and had completely forgotten about it's beneficial uses.

• ###### 6. Re: Calculate percentage of aggregated week values

Hi,

Create a calculation like this , Named it Complaint.

{ FIXED [Week NO] : IF SUM([Records Completed])<800 then 'N' ELSE 'Y' END }

create one more calculation like this COUNTD([Week NO]) , named it count.

select pie as chart type.Drag complaint into color shelf, Count into Angle and Label.

attached the workbook for reference.

• ###### 7. Re: Calculate percentage of aggregated week values

Many thanks Hima, that also works very well!