The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.
Market | Age Group | Population |
Country A | 00-04 | 1 |
Country A | 05-09 | 2 |
Country A | 10-14 | 3 |
Country B | 00-04 | 4 |
Country B | 05-09 | 5 |
Country B | 10-14 | 6 |
Country C | 00-04 | 7 |
Country C | 05-09 | 8 |
Country C | 10-14 | 9 |
Solved! Go to Solution.
Hi @AC1223,
Based on my test, the formula below should work in your scenario.
Measure = MEDIANX ( SUMMARIZE ( Table1, Table1[Market], "Total Population", SUM ( Table1[Population] ) ), [Total Population] )
Just replace Table1 with your real table name.
Regards
I created this measure below ( my table is called DataSelect):
Measure = DIVIDE ( SUM ( DataSelect[Population] ), DISTINCTCOUNT ( DataSelect[Market] ), BLANK () )
You have the output below, please let us know if it is not your expected results.
Ninter.
Hi Interkoubess,
Thankyou for your response.
The results are right in this case, but this is not calculating the median.
It does not work with other numbers.
eg, if I change the dataset to below:
Market | Age Group | Population |
Country A | 00-04 | 1 |
Country A | 05-09 | 100 |
Country A | 10-14 | 7 |
Country B | 00-04 | 80 |
Country B | 05-09 | 5 |
Country B | 10-14 | 2000 |
Country C | 00-04 | 30 |
Country C | 05-09 | 2 |
Country C | 10-14 | 50 |
Hi @AC1223,
Based on my test, the formula below should work in your scenario.
Measure = MEDIANX ( SUMMARIZE ( Table1, Table1[Market], "Total Population", SUM ( Table1[Population] ) ), [Total Population] )
Just replace Table1 with your real table name.
Regards