Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Join 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.

Reply
pr1ngl3
Regular Visitor

Calculate calculated fields by row

Afternoon - hoping someone can put me out of my misery....

pr1ngl3_3-1678455741854.png

 

Using the above as an example...

The following Tables have a relationship via a Customer Mapping table

Term is a calculated column from Contracts (basic datediff from Today() to term end date, in months)

GL has a calculated column to determine the last posting date of an invoice  

LastPostingDate = calculate(max(GL[Posting Date (bins)]),ALLEXCEPT(GL,GL[Customer Map]), GL[Posting Date] <= today())

Last Invoice is a measure to sum the value, filtering so the posting date is the same as the last posting date

LastInvoice = calculate(sum(GL[Amount]),filter(GL,GL[Posting Date (bins)] = GL[LastPostingDate]))

Remaining Revenue is a measure to multiply the 2 values

Remaining Revenue = calculate([LastInvoice] * MAX('Contracts'[Months Remaining]))

All this is working accurately per line (by customer) however, the Total (as expected) is also calulating in this was, summing the Last Invoice and multiplying by the MAX of the term remaining.  - highlighted in RED. Whereas, I need to calculate each line individually and sum that, highlighted in Green.

 

Any ideas?

 

Thanks in advance

1 ACCEPTED SOLUTION
DimaMD
Solution Sage
Solution Sage

Hi @pr1ngl3 Try it maesure

IF( HASONEVALUE('table'[Customer]),
 [Remaining Revenue],
 SUMX( VALUES('table'[Customer]),
 [Remaining Revenue]))

__________________________________________

Thank you for your like and decision

__________________________________________

Greetings from Ukraine

To help me grow PayPal: embirddima@gmail.com

View solution in original post

2 REPLIES 2
DimaMD
Solution Sage
Solution Sage

Hi @pr1ngl3 Try it maesure

IF( HASONEVALUE('table'[Customer]),
 [Remaining Revenue],
 SUMX( VALUES('table'[Customer]),
 [Remaining Revenue]))

__________________________________________

Thank you for your like and decision

__________________________________________

Greetings from Ukraine

To help me grow PayPal: embirddima@gmail.com

Thank you so much!! been struggling with this for a while.

Such a quick reply too 😁

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.