cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Regular Visitor

How to avoid SUM from one to many relationship tables

Hi,

 

I have a problem, I hope somebody can help me.

I have two tables:

 

Projects

IDName
1Project One
2Project Two
3Project Three

 

Invoice

IDProjectIDInvoice NumberAmount
111$100
222

$200

332$200

 

As you can see the relationship is 1:*, and there are invoices that correspond to many projects, in the example Invoice number 2. Obviosly The SUM in a Table in the report will be $500 because it is adding all the entries from the Invoice table. 

 

Is there any way to avoid it like grouping by Invoice number, because the correct SUM is only $300 because there is inly two invoices, but one of them is point to several projects.

 

Thanks in advance.

 

Thanks.

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Regular Visitor

Re: How to avoid SUM from one to many relationship tables

Thankl you for your help! It doesn't work, but finally I solve it as follows:

AmountSum =
SUMX(
    KEEPFILTERS(VALUES(Invoice[Invoice Number])),
    CALCULATE(MAX(Invoice[Amount]))
)

View solution in original post

3 REPLIES 3
Highlighted
Community Champion
Community Champion

Re: How to avoid SUM from one to many relationship tables

Hi @jareyesg 

 

You can create a reference table and group the table based on invoice to show max of invoce.

Power Query Editor --> Transform --> Group By

pranit828_0-1597299682380.png

 

 

 

Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!

Regards,
Pranit


Hope it resolves your issue? Please consider accepting it as the solution to help the other members find it more quickly.


Appreciate your Kudos, Press the thumbs up button!!👍


Regards,
Pranit


Highlighted
Super User IX
Super User IX

Re: How to avoid SUM from one to many relationship tables

@jareyesg , Create a measure like

sumx(summarize(Projects, Projects[ID],Invoice[Invoice Number], "_1", max(Invoice[Amount])),[_1])

 

I assume Projects and Invoice are joined



Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
Dashboard of My Blogs !! YouTube Channel !! Connect on Linkedin

Proud to be a Super User!

Highlighted
Regular Visitor

Re: How to avoid SUM from one to many relationship tables

Thankl you for your help! It doesn't work, but finally I solve it as follows:

AmountSum =
SUMX(
    KEEPFILTERS(VALUES(Invoice[Invoice Number])),
    CALCULATE(MAX(Invoice[Amount]))
)

View solution in original post

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Find your favorite faces from the community presenting at the Power Platform Community Conference!

Upcoming Events

Experience what’s next for Power BI

See the latest Power BI innovations, updates, and demos from the Microsoft Business Applications Launch Event.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Get Ready for Power BI Dev Camp

Get Ready for Power BI Dev Camp

Mark your calendars and join us for our next Power BI Dev Camp!.

Top Solution Authors
Top Kudoed Authors