Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
I have 2 unrelated tables with many to many records for Key, Loc, Risk are the fields in both tables. From Table 2, I need to Sum the Amount for only the mimimun ENDR value for each Key. Can someone suggest the best way to accomplish this? Below is an example of the 2 Power BI table.
Table 1
Account | Loc | Risk | Veh Nr |
A150376 | 9999 | 9995 | 1 |
A150376 | 9999 | 9991 | 1 |
A150376 | 9999 | 9998 | 1 |
A150376 | 9999 | 9997 | 1 |
A150376 | 9999 | 9992 | 1 |
A150376 | 9999 | 9994 | 1 |
A150376 | 9999 | 9993 | 1 |
A150376 | 9999 | 9999 | 1 |
A150376 | 9999 | 9996 | 1 |
Table 2
Account | Loc | Risk | ENDR | Amount |
A150376 | 9999 | 9999 | 0 | 6443 |
A150376 | 9999 | 9998 | 0 | 60 |
A150376 | 9999 | 9997 | 0 | 167 |
A150376 | 9999 | 9996 | 0 | 344 |
A150376 | 9999 | 9995 | 0 | 1034 |
A150376 | 9999 | 9994 | 0 | 20 |
A150376 | 9999 | 9993 | 0 | 33 |
A150376 | 9999 | 9992 | 0 | 0 |
A150376 | 9999 | 9991 | 0 | 0 |
A150376 | 9999 | 9999 | 1 | -6443 |
A150376 | 9999 | 9998 | 1 | -60 |
A150376 | 9999 | 9997 | 1 | -167 |
A150376 | 9999 | 9996 | 1 | -344 |
A150376 | 9999 | 9995 | 1 | -1034 |
A150376 | 9999 | 9994 | 1 | -20 |
A150376 | 9999 | 9993 | 1 | -33 |
A150376 | 9999 | 9999 | 2 | 6443 |
A150376 | 9999 | 9998 | 2 | 60 |
A150376 | 9999 | 9997 | 2 | 167 |
A150376 | 9999 | 9996 | 2 | 344 |
A150376 | 9999 | 9995 | 2 | 1034 |
A150376 | 9999 | 9994 | 2 | 20 |
A150376 | 9999 | 9993 | 2 | 33 |
A150376 | 9999 | 9992 | 2 | 0 |
A150376 | 9999 | 9991 | 2 | 0 |
A150376 | 9999 | 9999 | 6 | -5489 |
A150376 | 9999 | 9998 | 6 | -51 |
A150376 | 9999 | 9997 | 6 | -142 |
Solved! Go to Solution.
Hi @mmsalisbury
I was able to get there with a calculated column to add the MIN ENDR to table 1 and then a measure to calculate the sum. Take a look at the attachment. In my example I changed one of the ENDR to have a minimum of 1 instead of 0 for testing.
@Anonymous , Not Clear Try Like
New column in Table 1
Amount =min(Table2,table2[Account]=table1[Account] && table2[Loc]=table1[Loc] && table2[Risk]=table1[Risk]),table2[Amount ])
or
first New column in Table 1
ENDR =min(Table2,table2[Account]=table1[Account] && table2[Loc]=table1[Loc] && table2[Risk]=table1[Risk]),table2[ENDR ])
second New column in Table 1
Amount =min(Table2,table2[Account]=table1[Account] && table2[Loc]=table1[Loc] && table2[Risk]=table1[Risk] && table2[ENDR]=table1[ENDR]) ),table2[ENDR ])
Hi,
Please show the exact result that you are expecting.
Hi @mmsalisbury
I was able to get there with a calculated column to add the MIN ENDR to table 1 and then a measure to calculate the sum. Take a look at the attachment. In my example I changed one of the ENDR to have a minimum of 1 instead of 0 for testing.
I did get it to work. I appreciate your help and Thank you.
I understand your result and you related the tables. Can this be accomplished without relating tables due to many to many?
I didn't relate the tables. If you look at my sample they are not joined.
Check out the July 2025 Power BI update to learn about new features.
User | Count |
---|---|
73 | |
71 | |
38 | |
28 | |
26 |
User | Count |
---|---|
99 | |
88 | |
62 | |
42 | |
39 |