Showing results for 
Search instead for 
Did you mean: 
Regular Visitor

DAX calculation for Potential sales with table relationships

Hi all,


I am trying to get the potential sales measure as in the difference beetween sales order amount and sales invoice amount however I seem to have an issue with the table relationships.


Below is my dax code and image of the tables relationships




Potential Sales = 
    SUMX (
        SalesOrderLines[Order Amount]
            - CALCULATE (
                SUMX ( RELATEDTABLE ( SalesInvoiceV2Lines ), SalesInvoiceV2Lines[Sales Amount] ),
                FILTER (
                    SalesOrderLines[SalesOrderNumber] = SalesInvoiceV2Lines[SalesOrderNumber]





The code will not allow me to filter by the SalesOrderNumber from the invoicelines table. Any recommedations on the best way to do this or have I got it all wrong? Any assistance would be great.



Super User
Super User

@VinnieB ,

Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.

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

Learn Power BI Beginners !! Advance Power BI Concepts !! Power BI For Tableau User !! Learn Power BI in Hindi !!
Proud to be a Super User!

Helpful resources

UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

November Power BI Update 768x460.png

Check it Out!

Click here to read more about the November 2021 Updates!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.