Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
Hi Guys. I would like to add a calculated column in PowerBI which tells wheather a particular dimension is part of top 80% or bottom 20% of the value. For e.g. I have customer data, say 1000s of them across a number of countries with revenue and other dimensions in table like sales manager, order count etc. I would like to create a chart which shows the count of customers contributing to top 80% revenue and bottom 20% revenue. I created a column in excel indicating top 80% customer and bottom 20% customer and created a chart, but then I realize that I am not able to filter, slice and dice the data as the tags are hardcoded in excel. What is the best formula to achieve this? The outcome I am expecting is show a customer as "Top 80% customer" or "Bottom 20% customer" in a column, but then it has to autocalculate when I filter by other dimensions like product count, sales manager etc.
Kindly direct me to right formula and I am keen to try it out.
Thank you in advance !
Solved! Go to Solution.
I'm not quite certain about your requirement however this should give you some ideas on how to proceed...
You are asking for 2 different things
First Customer CATEGORY (this is a Measure)
Customer Category = SWITCH ( TRUE (), [MEASURE] < PERCENTILEX.INC ( ALLSELECTED ( Table[Customer] ), [MEASURE], 0.20 ), "Bottom 20%", [MEASURE] > PERCENTILEX.INC ( ALLSELECTED ( Table[Customer] ), [MEASURE], 0.80 ), "Top 80%", "Middle" )
And also you want to display COUNT of Customers (this is also a Measure)
Number of Top 80% Customers = CALCULATE ( DISTINCTCOUNT ( Table[Customer] ), FILTER ( ALLSELECTED ( Table[Customer] ), [MEASURE] > PERCENTILEX.INC ( ALLSELECTED ( Table[Customer] ), [MEASURE], 0.80 ) ) )
Following the above example you should be able to create the Number of Bottom 20% Customers Measure
Hope this helps!
I'm not quite certain about your requirement however this should give you some ideas on how to proceed...
You are asking for 2 different things
First Customer CATEGORY (this is a Measure)
Customer Category = SWITCH ( TRUE (), [MEASURE] < PERCENTILEX.INC ( ALLSELECTED ( Table[Customer] ), [MEASURE], 0.20 ), "Bottom 20%", [MEASURE] > PERCENTILEX.INC ( ALLSELECTED ( Table[Customer] ), [MEASURE], 0.80 ), "Top 80%", "Middle" )
And also you want to display COUNT of Customers (this is also a Measure)
Number of Top 80% Customers = CALCULATE ( DISTINCTCOUNT ( Table[Customer] ), FILTER ( ALLSELECTED ( Table[Customer] ), [MEASURE] > PERCENTILEX.INC ( ALLSELECTED ( Table[Customer] ), [MEASURE], 0.80 ) ) )
Following the above example you should be able to create the Number of Bottom 20% Customers Measure
Hope this helps!
I’m trying to understand your measure for “number of top 80% customers” and how the function PERCENTILEX.INC works. Seeing how the bottom 20% measure is written, won’t the top 80% measure actually deliver the top 20%?.
in other words, shouldn’t the measure to count the top 80% be
CALCULATE (
DISTINCTCOUNT ( Table [Customer] ),
FILTER (ALLSELECTED ( Table [Customer] ),
[MEASURE] > PERCENTILEX.INC (ALLSELECTED ( Table [Customer] ), [MEASURE], 0.20 )
which would exclude the bottom 20%?
Apologies upfront since it is the first time I have actually come across the PERCENTILEX.INC function. You can tell I’m a little confused!
Thanks!
Proud to be a Super User!
Paul on Linkedin.
Hello,
I am not able to develop to
Number of Top 80% Customers
When I am writing the measure appears that PERCENTILE.INC have too few arguments.
Can you help me please?
I wrote:
Thanks Sean.. You must be a genius !
I will try this out. Appreciate your input.
HI @Sreeram
Some sample data might be helpful. Also this can be done as a calcuated column or a calcuated measure. Each approach as different strengths and weaknesses.
Hi Phil, Thanks for your response.. Here is how the data could look like.. not sure where to attach this. So, copy pasting it here. Now, on this table, i would like to add another column called Customer Group with values "Top 80%" and "Bottom 20%". The groups obviosly has to be Auto-calculated using the revenue figures and should get recalculated when we filter by country (s).
Customers | Revenue | Country |
a | 11301 | USA |
b | 1610 | USA |
c | 16110 | USA |
d | 1155 | USA |
e | 10765 | USA |
f | 1500 | USA |
g | 14280 | USA |
h | 18238 | USA |
i | 15238 | USA |
j | 3336 | USA |
k | 9525 | USA |
l | 10561 | USA |
m | 2356 | USA |
n | 2926 | USA |
o | 13777 | USA |
p | 10976 | USA |
q | 5201 | USA |
r | 14498 | USA |
s | 9545 | USA |
t | 11098 | USA |
u | 3677 | USA |
v | 15259 | USA |
w | 13213 | USA |
x | 8866 | UK |
y | 7860 | UK |
z | 5239 | UK |
a | 1424 | UK |
b | 15785 | UK |
c | 16220 | UK |
d | 1609 | UK |
e | 10132 | UK |
f | 10449 | UK |
g | 14930 | UK |
h | 3612 | UK |
i | 13157 | UK |
j | 16352 | UK |
k | 8083 | UK |
l | 16405 | UK |
m | 14870 | UK |
n | 1999 | UK |
o | 15612 | UK |
p | 16773 | UK |
q | 3937 | UK |
r | 3146 | UK |
s | 13796 | UK |
t | 18189 | UK |
u | 6502 | UK |
v | 5419 | UK |
w | 3174 | UK |
x | 8544 | UK |
y | 9413 | UK |
z | 12751 | UK |
b | 12413 | UK |
c | 15177 | UK |
d | 14567 | UK |
e | 11961 | UK |
f | 9223 | UK |
g | 7131 | UK |
h | 13663 | UK |
i | 11466 | UK |
j | 3379 | UK |
k | 13380 | UK |
l | 5475 | UK |
m | 3514 | UK |
n | 16942 | UK |
o | 18707 | UK |
p | 13596 | UK |
q | 12544 | UK |
r | 6943 | India |
s | 6848 | India |
a | 7366 | India |
b | 2129 | India |
c | 14981 | India |
d | 9033 | India |
e | 13097 | India |
f | 8710 | India |
g | 18165 | India |
h | 15658 | India |
i | 2701 | India |
j | 15871 | India |
k | 2000 | India |
l | 10192 | India |
m | 4356 | India |
n | 1998 | India |
o | 14126 | India |
p | 7455 | India |
q | 17172 | India |
r | 10119 | India |
s | 1512 | India |
t | 7219 | India |
u | 1236 | India |
v | 13803 | UAE |
w | 13340 | UAE |
x | 12497 | UAE |
y | 18269 | UAE |
z | 17554 | UAE |
a | 18743 | UAE |
b | 17816 | UAE |
c | 8272 | UAE |
d | 10841 | UAE |
e | 2039 | UAE |
f | 16294 | UAE |
g | 12700 | UAE |
h | 5429 | UAE |
i | 11608 | UAE |
j | 18841 | UAE |
k | 3961 | UAE |
l | 13205 | UAE |
m | 7225 | UAE |
n | 17641 | UAE |
o | 10872 | UAE |
p | 3880 | UAE |
q | 11737 | UAE |
r | 11747 | UAE |
s | 11597 | UAE |
t | 10646 | UAE |
u | 13644 | UAE |
v | 10354 | UAE |
w | 16047 | UAE |
x | 12177 | UAE |
y | 4964 | UAE |
z | 3661 | UAE |
b | 13380 | UAE |
c | 18018 | UAE |
d | 13789 | UAE |
e | 3782 | UAE |
f | 16079 | UAE |
g | 15841 | UAE |
h | 14269 | UAE |
i | 1654 | UAE |
j | 16214 | UAE |
k | 10116 | UAE |
l | 14904 | UAE |
m | 13176 | UAE |
n | 1993 | UAE |
o | 1860 | UAE |
p | 10964 | UAE |
q | 17709 | UAE |
r | 14694 | UAE |
s | 15701 | UAE |
y | 9717 | UAE |
z | 5175 | UAE |
a | 10639 | UAE |
b | 4153 | UAE |
c | 15100 | UAE |
d | 7779 | UAE |
e | 15051 | UAE |
f | 18249 | UAE |
g | 14365 | UAE |
h | 6922 | UAE |
i | 17802 | UAE |
j | 8347 | UAE |
k | 18422 | UAE |
l | 7831 | UAE |
m | 1127 | UAE |
n | 5396 | UAE |
o | 17067 | UAE |
p | 7285 | UAE |
q | 9433 | UAE |
r | 6226 | UAE |
s | 12997 | UAE |
t | 10941 | UAE |
u | 2863 | UAE |