Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Quartiles and average per quartile

Hi,

 

I need some help with creating rank and quartiles based on the result of a measure. I then need to be able to list the average result for each quartile.

 

I have included a (very oversimplified) sample file https://1drv.ms/u/s!AnRGj-TQo1jAg-MNMTUq62UGVjTcSw?e=df6yJa 

 

The output I need is twofold:

1. The Quartile of Conversion by employee:

 

Employee NameConversion (Measure)RankQuartile
Employee 1992.0%11
Employee 1784.7%21
Employee 0279.7%31
Employee 1479.2%41
Employee 0578.0%51
Employee 1877.8%62
Employee 0877.4%72
Employee 1576.2%82
Employee 1174.9%92
Employee 1074.7%102
Employee 0473.1%113
Employee 0672.5%123
Employee 1269.7%133
Employee 1368.2%143
Employee 0167.9%153
Employee 0366.4%164
Employee 2064.3%174
Employee 0962.2%184
Employee 1660.2%194
Employee 0756.1%204

 

and then the average conversion for each quartile:

 

QuartileAverage Conversion
182.7%
276.2%
370.3%
461.8%

 

I am going round in circles, I can't quite get quartiles to display correctly using PERCENTILE.INC() and I don't know where to start with the average conversion per quartile!


Any help would be greatly appreciated. It's driving me nuts!

1 ACCEPTED SOLUTION
parry2k
Super User
Super User

@Anonymous I never did this before but I gave it a shot, solution is attached, you can tweak it as you see fit.

 

parry2k_0-1629471693748.png

 

Follow us on LinkedIn

 

Check my latest blog post The Power of Using Calculation Groups with Inactive Relationships (Part 1) (perytus.com) I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!

 

Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.

 

 

 



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

@parry2k I think I have a problem that I don't know how to resolve. My actual data is much more complicated and cannot be shared. I'm having to use ALLSELECTED, as I have a filterable list of employees, not just ALL. In the Rank, this works perfectly. 
For some reason, using that same ALLSELECTED to replace ALL within PERCENTILEX.INC, using your DAX means that all the 0.25, 0.5 amd 0.75 comes out to the same value - the highest value of Rank and therefore the Quartile result is 1 for everyone.

My suspision is that ALLSELECTED is changing the context to the row, when it's used in a VAR in this way, and I cannot figure out how to change that. Any ideas?

 

Anonymous
Not applicable

I actually think I cracked this myself. I have 2 columns in my employee table:

 

Employee NameEmployee Number
John Smith001
Jane Doe002
Joe Bloggs003
John Smith004

 

 

Originally I had a problem where I had multiple employees with the same names, so had added 2 calculated columns, 1 to count the instances of that employee name and the other to concatenate the name and employee number if there were more than 2 people with the same name, I figured a calculated column would be fine for only a few hundred rows of data:

 

  Calculated ColumnCalculated Column
Employee NameEmployee NumberName CountNew Employee Name
John Smith0012John Smith (001)
Jane Doe0021Jane Doe
Joe Bloggs0031Joe Bloggs
John Smith0042John Smith (004)

 

Basing my PERCENTILEX.INC using HASONEVALUE on the New Employee Name Calculated column just would not work - as soon as I moved the Name Count / New Employee Name logic into Power Query, it worked a treat!

parry2k
Super User
Super User

@Anonymous I never did this before but I gave it a shot, solution is attached, you can tweak it as you see fit.

 

parry2k_0-1629471693748.png

 

Follow us on LinkedIn

 

Check my latest blog post The Power of Using Calculation Groups with Inactive Relationships (Part 1) (perytus.com) I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!

 

Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.

 

 

 



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Anonymous
Not applicable

@parry2k Thank you so much, I think you cracked it for me. I will have a go at translating this into my more complicated model, wish me luck and thanks again!

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.