Title: Power BI - Conditionally format top/bottom cumulative percentage?
Tags: powerbi;treemap
Question: Looked around a long time now, and cannot find a way to conditionally format the values in a table, treemap, bar chart etc. if they are within the say, top 80% of all the values.
So let's say I have a table with sales and profit. Then I have a treemap showing the profit by city. I manage to get the percentage of total with:
% of total profit = SUM(Orders[Profit])/CALCULATE(SUM(Orders[Profit]),ALL(Orders))
..so that is no issue. But how would I go about formatting the cities that are within the top 80% of all profit? Any suggestion on approach?
Example:
Say I have the treemap below. The first four categories would fall within the top 80% of the total. Cumulatively it would be: 35%,  55%, 70% and 85%. So my need is to color only these in a specific way (and preferably any that falls outside of that range, in another color).
I take it that finding the logic to do this, likely though a measure somehow to base the formatting on, will then also be something that would be applicable to bar charts etc. (more traditional pareto).

Here is the accepted answer: OK, here is the solution. I will provide a traditional pareto and an adapted one according to your requirements. My data looks like this.
Create 3 measure as follows:
Profit Measure = SUM('Table'[Profit])
Pareto =
VAR amount = [Profit Measure]
VAR total = CALCULATE( [Profit Measure], REMOVEFILTERS('Table'))
VAR result = CALCULATE([Profit Measure], FILTER(ALL('Table'),[Profit Measure]&gt;= amount))/total
RETURN result
Threshold =
VAR pareto = [Pareto]
VAR previousPareto = MAXX( FILTER( SUMMARIZE(ALL('Table'),'Table'[Order],'Table'[Profit],&quot;p&quot;, [Pareto]), [p] < pareto), [Pareto])
RETURN IF( ISBLANK( previousPareto), pareto, previousPareto)
Create a table visual so you can see what is happening. In the table below, the Pareto measure is creating a cumulative percentage based on profit. If you were to use this, you can see that only A and B are cumulatively the only values actually < 80% and so they would be the only ones coloured. What you are asking for is slightly different which is what the threshold measure is showing. This outputs the previous pareto (or current if there is no previous).
In the tree map, I have created the conditional formatting as follows for standard pareto.
And as follows for the adapted pareto.

Here is another answer: Click the fx icon under colors.
Select Rules for Format style, your measure as the field and then set up a rule (in your case, &gt;= 0.2 for top 80%).
Comment for this answer: Hi. This will only format any of the squares in my treemap that individually is over 20%. What I am looking for is to format all squares that fall within the top 80% of the total of all squares.  So for example, if square one is 35% of total, square two is 20% of the total, suqare three is 15% of the total and square four is 15% of the total.. then they should all be formatted, since they all fall within the top 80%. I will update my question.
Comment for this answer: so sorry. Was out of office. It was solved. Thank you so much!
Comment for this answer: I understand now. You want a pareto measure for the conditional formatting. Are you sure your example is correct though. You are ordering by cumulative profit and your first two add up to 55% which is less than 80% so fine. Your next two are treated equally though (15% and 15%) and their combined value takes you to 85% which means they would not fall in the category of your 80% and would not get coloured. Can you clarify?
Comment for this answer: Was your problem solved?

{'source': 'StackExchangeDataset', 'subset': 'stackoverflow.com', 'metadata': {'AnswerCount': 2, 'CommentCount': 0, 'ContentLicense': 'CC BY-SA 4.0', 'CreationDate': '2022:00:06/23/22', 'FavoriteCount': None, 'PostTypeId': 1, 'Tags': '<powerbi><treemap>', 'Title': 'Power BI - Conditionally format top/bottom cumulative percentage?', 'ViewCount': 103, 'id': 72730310, 'user_AboutMe': '', 'user_AccountId': 3137545.0, 'user_DisplayName': 'Streching my competence', 'user_Reputation': 371.0, 'user_Views': 267.0, 'user_id': 2653750.0}}