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
Anonymous
Not applicable

Help combining totals from two tables in a many to many relationship

Hello!
Im trying to calculate total from two tables but wih no sucess
 
I have a setup like this:

 Table 1: Membership, table 2: Transactions, table3: payments

 

Table 1 
Member IDAlphanumeric
Membership Start Datedate
Membership End Datedate
Transaction Date 
Premium Amountdouble
Fee type IDshort text (i.e. New, Adjustment, Cancel)

 

Table 2 
Member IDAlphanumeric
Membership Start Datedate
Transaction Detailstext (this is a summary of various columns to keep the example simple)
Transaction IDAlphanumeric

 

Table 3 
Transaction IDAlphanumeric
Transaction Datedate
Transaction Total Spenddouble
Transaction Total Outstandingdouble

 

In table1 and table3 i calculate the transaction development month relative to a fixed date (the same in both tables) and call this report_month ( TableX[transaction date].month+((TableX[transaction date].year-YYYY)*12)

 

Table 1 and table 2 are linked by the Member ID, and have a Many - to - Many relationship as there can be duplicate Member ID's in table 1 (due the possiblity to amend membership or cancel membership)

Table 2 and table 3 are linked by the Transaction ID and have a 1 - to - Many relationship as each transaction ID exists only once in table 2, but multiple times in table 3.

 

 

In table 1, you can have multiple transactions per membership (for example New, change of membership level, Cancellation)

Each Row shows the amount paid (or refunded) and so needs to be aggregated at each point

for example a time line of the transactions make look like this if i were to summarise it in a table in power BI

lets assume they make a chane to their membership in month 3 and cancel in month 6 and get a partial refund

note all the tables below are produced using the matrix functionality

Memberreport month 1report month 2report month 3report month 4report month 5report month 6
150020000-260

 

So the running total may look like this (Achieved in power BI using a measure)

Memberreport month 1report month 2report month 3report month 4report month 5report month 6
1500520520520520260

 

In table 2, you have transactions, but this table tracks the running total already rather than the individual transactions so the table would look like this for the total spend (note i dont need the interim step like i did on table 1 to get the running total; i could calculate the incremental point but this is not what i need).

Member start datereport month 1report month 2report month 3report month 4report month 5report month 6
Jan00100120140200

 

Transaction Total Outstanding would look something like this

Member start datereport month 1report month 2report month 3report month 4report month 5report month 6
Jan0010080600

 

What im trying to do is create a new table that shows the Transaction Total Spend (from table 3) and the running total membership fee paid (from table 1) in the same table, something like this:

Member start datemonth 1month 1month 2month 2month 3month 3etc...
JanRuning Total FeeTotal SpendRuning Total FeeTotal SpendRuning Total FeeTotal Spend 
150005200520100 

 

I've tried to do this but i think there is an issue with the link between the calculated report_month column in table1 and table3, as when i try to do this overall for all memebers, i get a different progression for the Running total Fee if i use the table3.report_month as the column and conversely simmilarly i get a different progression for the Total Spend if i use the table1.report_month as the column.

 

Ultimately i'd also like to create a table that shows the Total Spend relative to the Runing Total Fee at each month, but coul figure this out so though figuring out how to display the two correctly side by side would be a good start to understand what is goin on.

1 REPLY 1
lbendlin
Super User
Super User

Please provide sanitized sample data that fully covers your issue. If you paste the data into a table in your post or use one of the file services it will be easier to assist you. Avoid posting screenshots of your source data if possible.

Please show the expected outcome based on the sample data you provided. Screenshots of the expected outcome are ok.

https://community.powerbi.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523

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.