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

August 2022 update 768x460.jpg

Check it Out!

Click here to learn more about the August 2022 updates!

August 1 episode 9_no_dates 768x460.jpg

The Power BI Community Show

Watch the playback when Priya Sathy and Charles Webb discuss Datamarts! Kelly also shares Power BI Community updates.

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Top Solution Authors
Top Kudoed Authors