The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
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 =
CALCULATE (
SUMX (
SalesOrderLines,
SalesOrderLines[Order Amount]
- CALCULATE (
SUMX ( RELATEDTABLE ( SalesInvoiceV2Lines ), SalesInvoiceV2Lines[Sales Amount] ),
FILTER (
SalesOrderLines,
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.