Showing results for 
Search instead for 
Did you mean: 
Not applicable

Calculating Quartile Based on values in visual

I have a table which has some zip codes and their corresponding population. I am using a visual where i want to show  which zip falls under which quartile based on their population. The zips showing in that visual are filtered based on a slicer. So instead of using the population within the whole table, I want the quartile to be calculated based on population of ONLY the zips within that visual. This is the formula i used but I dont think it is showing the right data


Q Population = var high = PERCENTILE.INC('Calculated'[POPULATION],.75) Var mid = PERCENTILE.INC('Calculated'[POPULATION],.50) var low = PERCENTILE.INC('Calculated'[POPULATION],.25) return if(('Calculated'[POPULATION])<= low, "Q1", IF(AND(('Calculated'[POPULATION])<= mid,('Calculated'[POPULATION])>low), "Q2", if(and(('Calculated'[POPULATION]) <=high,('Calculated'[POPULATION])> mid ), "Q3","Q4")))


Not applicable

@Jihwan_Kim  You understood my problem right and I am able to understand the approach you are taking but i think because of my data size or maybe because of the number of other criterias, it is taking time to create rank.


Super User
Super User

Hi, @Anonymous 

Please correct me if I wrongly understood your question.

please check the below picture and the sample pbix file's link down below, whether it is what you are looking for.


all measures are in the sample pbix file.





Hi, My name is Jihwan Kim.

If this post helps, then please consider accept it as the solution to help other members find it faster, and give a big thumbs up.

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.

Go to My LinkedIn Page

Helpful resources

PBI Sept Update Carousel

Power BI September 2023 Update

Take a look at the September 2023 Power BI update to learn more.

Learn Live

Learn Live: Event Series

Join Microsoft Reactor and learn from developers.

Dashboard in a day with date

Exclusive opportunity for Women!

Join us for a free, hands-on Microsoft workshop led by women trainers for women where you will learn how to build a Dashboard in a Day!

Top Solution Authors