Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Raffael
Frequent Visitor

DAX Measure for Sum over m-n relationship

Hello Power BI Community,

 

i have troubles with a dax measure to calculate a sum over several tables.

 

i have one table to allocate certain people to defined regions via ids.  those ids are linked to a list of adimistrative regions via the ids (1-*) (one adm. region has one or multiple ids allocated to it). the administrative regions are linked to a list of distinct administrative regions (1-*). to the same list a table with region names and sales is linked (*-1)

tl:dr: sales person 1-* (via ids) admin region *-1 distinct admin region 1-* sales figues

what i want is to create a measure that sums up the sales figure for each sales person. I am able sum up the sales figures for the distinct admin regions, i can also slice all distinct admin regions by the sales person's name.

However i can not create the sum for all selected admin regions when slicing by a sales person. Seems to be some context issue i can'T wrap my head around as i always get the total sum, no matter the slicing.

 

Can somebody help me creating a measure to sum up the sales figures for the individual sales persons?

Best Regards,

1 ACCEPTED SOLUTION
v-danhe-msft
Employee
Employee

Hi @Raffael,

Based on my test, you could refer to below steps:

Sample data:

sales person.PNG

Creaete a measure

Measure = CALCULATE(AVERAGE('sales figues'[Sales]),FILTER('sales person','sales person'[id]=MAX('admin region'[Id])))

Result:

2.PNG

You can also download the PBIX file to have a view.

https://www.dropbox.com/s/c0v7rfewie0vhfw/DAX%20Measure%20for%20Sum%20over%20m-n%20relationship.pbix...

 

Regards,

Daniel He

Community Support Team _ Daniel He
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

1 REPLY 1
v-danhe-msft
Employee
Employee

Hi @Raffael,

Based on my test, you could refer to below steps:

Sample data:

sales person.PNG

Creaete a measure

Measure = CALCULATE(AVERAGE('sales figues'[Sales]),FILTER('sales person','sales person'[id]=MAX('admin region'[Id])))

Result:

2.PNG

You can also download the PBIX file to have a view.

https://www.dropbox.com/s/c0v7rfewie0vhfw/DAX%20Measure%20for%20Sum%20over%20m-n%20relationship.pbix...

 

Regards,

Daniel He

Community Support Team _ Daniel He
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.