Microsoft Fabric Community Conference 2025, March 31 - April 2, Las Vegas, Nevada. Use code FABINSIDER for a $400 discount.
Register nowThe Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.
Problem to use DATEDIFF function between two dates which located in two but not directly related tables.
Task: Stock.Registration_Date - Invoices.InvoiceDate
Formula: NeedDate= DATEDIFF([Registration_Date],RELATED(Invoices[InvoiceDate]),WEEK)
Err: The column 'Invoices[InvoiceDate]' either doesn't exist or doesn't have a relationship to any table available in the current context
Comments: There two tables "Stock" and "Invoice" - they are related through table in between "InvoiceLines".
Thank you
Solved! Go to Solution.
Given the relationship, you may use RELATEDTABLE Function.
MAXX ( RELATEDTABLE ( Invoices ), Invoices[InvoiceDate] )
For now "Stock" table.. - where i am trying to create new Measure. (In the future this New Measure should be used in
report(Visualization)
but i mentioned those three tbls because tbl InvoiceLines is in between two Main tbls "Stock" and "Invoices"
I need one field from Stock and one from Invoices (they are not linked directly - but only through InvoiceLines )
tnx
Angelika
Given the relationship, you may use RELATEDTABLE Function.
MAXX ( RELATEDTABLE ( Invoices ), Invoices[InvoiceDate] )
Sam,
i think it solved my issue:
Weeks in stock = DATEDIFF([Registration_Date],MAXX(RELATEDTABLE(Invoices),Invoices[InvoiceDate]),WEEK)
I would never thought that MAXX can act as a little liason between "unrelated" tables
Thank you much
Angelika
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Check out the February 2025 Power BI update to learn about new features.
User | Count |
---|---|
82 | |
81 | |
52 | |
39 | |
35 |
User | Count |
---|---|
95 | |
79 | |
52 | |
49 | |
47 |