Forum Discussion
Display specific percentiles in a table
- 6 years ago
Hi cabadart ,
We can create three columns and four measures to meet your requirement.
1. First delete the relationship between two tables.
2. Create three columns of percentages separately.
A % = var x = CALCULATE( SUM('AgeData'[Count]), FILTER( 'AgeData', AgeData[Category] = "A"&& AgeData[Age]<=EARLIER(AgeData[Age]) ) ) var y = CALCULATE(SUM(AgeData[Count]),FILTER(ALLSELECTED(AgeData),AgeData[Category]="A")) return DIVIDE(x,y)B % = var x = CALCULATE( SUM('AgeData'[Count]), FILTER( 'AgeData', AgeData[Category] = "B"&& AgeData[Age]<=EARLIER(AgeData[Age]) ) ) var y = CALCULATE(SUM(AgeData[Count]),FILTER(ALLSELECTED(AgeData),AgeData[Category]="B")) return DIVIDE(x,y)C % = var x = CALCULATE( SUM('AgeData'[Count]), FILTER( 'AgeData', AgeData[Category] = "C"&& AgeData[Age]<=EARLIER(AgeData[Age]) ) ) var y = CALCULATE(SUM(AgeData[Count]),FILTER(ALLSELECTED(AgeData),AgeData[Category]="C")) return DIVIDE(x,y)3. Then we can create four measures to get A, B, C and All.
A = CALCULATE(MIN(AgeData[Age]),FILTER(AgeData,AgeData[A %]>=MAX(PercentilesToDisplay[Percentile])))B = CALCULATE(MIN(AgeData[Age]),FILTER(AgeData,AgeData[B %]>=MAX(PercentilesToDisplay[Percentile])))C = CALCULATE(MIN(AgeData[Age]),FILTER(AgeData,AgeData[C %]>=MAX(PercentilesToDisplay[Percentile])))All = CALCULATE(MIN(AgeData[Age]),FILTER(AgeData,AgeData[%]>=MAX(PercentilesToDisplay[Percentile])))Put them to values and not add category to column, the result like this,
If you have any question, please kindly ask here and we will try to resolve it.
BTW, pbix as attached.
Best regards,
Community Support Team _ zhenbw
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi cabadart ,
Sorry for that we don’t understand what is your desire result clearly.
Maybe you can try a measure like this,
Measure = CALCULATE(MAX(‘AgeData’[Age]),FILTER('AgeData', [CumulativePercent]<=[Percentile]))
If it doesn’t meet your requirement, could you please provide a mockup sample based on fake data or describe the fields of each tables and the relations between tables simply?
It will be helpful if you can show us the exact expected result based on the tables.
Please upload your files to OneDrive For Business and share the link here. Please don't contain any Confidential Information or Real data in your reply.
Best regards,
Community Support Team _ zhenbw
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
I created a sample data file https://microsoft-my.sharepoint-df.com/:u:/p/cabadart/EXNoRVG-Qu1JlIRN_WPDHOEBEA9OBO9eP8cwwFHhqgg6UA?e=1yDaR1
I tried the measure you provided but it does not match the expected results:
| Percentile | Measure | Expected (true) value |
| 50% | 229 | 2 |
| 75% | 237 | 12 |
| 90% | 239 | 32 |
| 95% | 239 | 48 |
| 99% | 239 | 117 |
| 99.9% | 239 | 209 |
| 99.99% | 239 | 236 |
One added layer of complexity that I did not mention in my original post is that there are 3 different Categories in this data. I would like this to be calculated as a measure so that it is updated when users select different combinations of the Categories to display. Thank you!