Forum Discussion

Dunner2020's avatar
Dunner2020
Icon for Post Prodigy rankPost Prodigy
5 years ago
Solved

80-20% pie chart distribution

Hi there,

 

I got data on events that occurred in different areas. I have a measure that calculates no of events occurred in different areas. The measure looks like:

 

no of events  = calculate( countx(filter(table, table[Event date]<=Today()), table[event id]))

 

I create the meaure for ranking:

Rank = RANKX(ALLSELECTED('Table'[AreaCode]),[No of Interruptions],,DESC,Skip)

 

Then I create another measure that calculates the cumulative sum of no of events:

 

cumulative sum = 

Var Total_incidents = [No of Interruptions]
Var currentRank = [Rank]
Return
SUMX(FILTER(ALLSELECTED('Table'[AreaCode]),[Rank]<=currentRank),[No of events])
 
 
Now, I am trying to create a pie chart that displays Pareto distribution in such a way that it shows the name of those areas that contribute to 80% of total events whereas show 'others' (not the name of area) for the remaining 20%.  
 
Pie_chart = 
Var total_events = [No of events]
Var cal_percent = [cumulative sum] /total_events
return
IF(cal_percent <= 0.8, Max('Table'[AreaCode]),"Others")
 
However, it's not producing the desired output. I am not sure where am I making the mistake. Any help would be really appreciated. Data can be download from here