Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.
I have a table in PowerBI called "Dati Popolazione ATTR", which is something like:
Region | Province | Town | Population | Males | Females | Attribute
R1 | P1 | T1 | 1000 | 500 | 500 | A1
R1 | P1 | T1 | 1000 | 500 | 500 | A2
R1 | P1 | T1 | 1000 | 500 | 500 | A3
R2 | P2 | T2 | 2000 | 600 | 1400 | A1
R2 | P2 | T2 | 2000 | 600 | 1400 | A2
R2 | P2 | T2 | 2000 | 600 | 1400 | A3
R3 | P3 | T3 | 1500 | 550 | 950 | A1
R3 | P3 | T3 | 1500 | 550 | 950 | A2
R3 | P3 | T3 | 1500 | 550 | 950 | A3
I want to create a quick measure called 'Affinity'. This should have the following calculation:
Affinity = sum of the selected attribute / sum of the selected attribute in absolute terms regardless of any filter
Denominator should not vary if I select any filter.
Can you help me?
Solved! Go to Solution.
Hi @Anonymous ,
Check the formula and if the result is what you want. If not, please show the expected result to us.
Affinity = CALCULATE(SUM('Table'[Population]),ALLSELECTED('Table'))/CALCULATE(SUM('Table'[Population]),ALL('Table'))
Best Regards,
Jay
Hi @Anonymous ,
Check the formula and if the result is what you want. If not, please show the expected result to us.
Affinity = CALCULATE(SUM('Table'[Population]),ALLSELECTED('Table'))/CALCULATE(SUM('Table'[Population]),ALL('Table'))
Best Regards,
Jay
Hi @Anonymous ,
You should do a measure similar to the one below:
Affinity = DIVIDE(SUM(Table[Population]), CALCULATE(SUM(Table[Population]),ALL(Attribute)))
Using the ALL syntax will allow you to get the values without any filtering.
Regards
Miguel Félix
Proud to be a Super User!
Check out my blog: Power BI em Português