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
dovrosenberg
Regular Visitor

Help understanding the rows used by a measure in many-to-many relationship

I have two queries:

Budgets - contains columns for store, sales_amount, and a field with a concatenation of year and week (ex. 2018;1) so there is a single row in this query for each combination of store and week.

 

Dates - contains a row for every relevant date, along with a variety of information about that date, including the same concatenation of year and week, as well as a field that indicates how long ago that date was from today (in weeks)

 

The tables are joined to each other on the year/week field.  It is a many to many relationship because there are 7 dates for each week and there are multiple locations for each week.

 

I created a measure that is the sum of sales_amount.  I then created a card to show that measure filtered to show only the date rows where the "weeks ago" field was 1, I was concerned about how I going to get it to sum just a single value per week, but was surprised to find out that it worked immediately.  Obviously, in SQL this join would have produced 7 copies of each budget row, one for each date in that week.  But that's not happening.  

 

Is this the expected behavior (I'm assuming it is, but try to make sure I understand the boundaries of how it works)?  It appears that only distinct rows are being considered by the measure, where distinct is determined using only the fields that are actually used by the visualization (including its filters, page filters, etc.)  Is that the right way to think about what it's doing?

1 ACCEPTED SOLUTION
v-yulgu-msft
Employee
Employee

Hi @dovrosenberg,

 

Since you established a relationship based on Year-Week, the row context the measure is calculated based on should be Year-Week. So, it returned weekly total rather than daily. Here are some links written about row context:

Row Context

What is Row Context?

 

Regards,

Yuliana Gu

Community Support Team _ Yuliana Gu
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

2 REPLIES 2
v-yulgu-msft
Employee
Employee

Hi @dovrosenberg,

 

Since you established a relationship based on Year-Week, the row context the measure is calculated based on should be Year-Week. So, it returned weekly total rather than daily. Here are some links written about row context:

Row Context

What is Row Context?

 

Regards,

Yuliana Gu

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

Thanks.  Those links were super helpful.

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.