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.
Order |
Order number |
Amount |
Invoice |
Invoice number |
Amount |
Order number |
Solved! Go to Solution.
@Velafyko , create a common dimension of Order number, refer the code in the file
https://www.dropbox.com/s/op9lb78w9utdonz/Distinct%20from%20two%20Tables.pbix?dl=0
refer
https://www.seerinteractive.com/blog/join-many-many-power-bi/
I agree you should improve your model and get rid of the M2M, but FYI there is another way to path the Order Number filter between the tables.
RelatedOrderSum= CALCULATE(SUM(Order[Amount]), TREATAS(VALUES(Invoice[Order number]), Order[Order number]))
You can swap the two order number columns in the TREATAS; not sure which invoice # column you are using in the visual.
If this works for you, please mark it as the solution. Kudos are appreciated too. Please let me know if not.
Regards,
Pat
To learn more about Power BI, follow me on Twitter or subscribe on YouTube.
Unfortunately I don't get your formula to work. It just gives me the same result as my original formula with the USERELATIONSHIP function. It works when there is only one order, but not when there are multiple orders for an invoice.
Yes, one order can lead to multiple invoices. For instance when not everything ordered is in stock, then what is in stock is shipped together with an invocice. When the remaining items are back in stock, they are shipped with a new invoice from the same order. Ideally we should have exactly one invoice for each order, but it's not always the case.
I hoped I could avoid changing the data model, but it seems like I have no choice then. Thank you 🙂
@Velafyko , create a common dimension of Order number, refer the code in the file
https://www.dropbox.com/s/op9lb78w9utdonz/Distinct%20from%20two%20Tables.pbix?dl=0
refer
https://www.seerinteractive.com/blog/join-many-many-power-bi/
@Velafyko - I would avoid many-to-many relationships like the plague and use a bridge table of unique order numbers.
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 |
---|---|
10 | |
9 | |
8 | |
8 | |
7 |
User | Count |
---|---|
13 | |
12 | |
11 | |
11 | |
8 |