Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
I have 4 tables:
Invoice Calendar
Invoices
Projects
Complete Calendar
They are each related, the Invoice Calendar is related to Invoices throug a calendar ID, the Invoices are related to each Project using a Project ID, and each Project is related to the Complete Calendar through a Calendar ID.
What I need is to make a measure which will show me the difference between the Complete Date and Invoice Date in the two tables, and I need to show it like this in Power BI:
Project | Invoice | Complete Date | Invoice Date | Diff |
1 | 1 | 01/01/2021 | 02/01/2021 | 1 |
1 | 2 | 01/01/2021 | 03/01/2021 | 2 |
1 | 3 | 01/01/2021 | 06/01/2021 | 5 |
2 | 1 | 05/01/2021 | 08/01/2021 | 3 |
I've tried setting variables etc. but I cant make it select the column. And I want the connection to be live, and I don't have access to the data model, so it has to be a measure I can put in.
Lookup value?
https://dax.guide/lookupvalue/
Proud to be a Super User!
Awesome Keyboard Shortcusts in Power BI, thumbs up if you like the article
My Community Blog Articles (check them out!)
My Blog - Power M code to automatically detect column types -
How to create test data using DAX!
[Diff] =
var OneProjectVisible = HASONEVALUE( Projects[Project ID])
var OneInvoiceVisible = HASONEVALUE( Invoices[Invoice ID] )
var Result =
if( OneProjectVisible && OneInvoiceVisible,
var CompleteDate =
CALCULATE(
SELECTEDVALUE( 'Complete Calendar'[Date] ),
Projects
)
var InvoiceDate =
CALCULATE(
SELECTEDVALUE( 'Invoice Calendar'[Date] ),
Invoices
)
return
// Assumption is that all projects and all
// invoices do have non-blank invoice dates
// and completion dates. If not, you'll have
// to adjust this formula to account for cases
// where this assumption is not true. And, of
// course, I assume that an invoice can have
// at most 1 invoice date. Same is true for
// projects - there's at most only one completion
// date for each of them.
InvoiceDate - CompleteDate
)
return
Result
@C-Jac , you need to do it using a common table/s
Refer this: https://community.powerbi.com/t5/Community-Blog/Decoding-Direct-Query-in-Power-BI-Part-2-Date-Differ...
same is true for import mode
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
47 | |
24 | |
20 | |
15 | |
13 |
User | Count |
---|---|
55 | |
48 | |
43 | |
19 | |
19 |