Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
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.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
58 | |
58 | |
56 | |
38 | |
29 |
User | Count |
---|---|
75 | |
62 | |
45 | |
40 | |
39 |