Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.
Hello,
I am trying to find out the number of days difference between two dates. I thought this would be a fairly easy subtraction but I seem to be struggling due to the dates coming from different data sets. I have looked through previous queries but they all appear to be from the same dataset.
I would like to subtract the order date from the posting date, so for example the top one will show as 1 day. 'Order_date' is from one dataset and 'Posting_date' is from another.
Can anyone advise please?
Kind regards,
Adam
Solved! Go to Solution.
maybe you can try this
datediff(max(orderdate),max(postingdate),day)
Proud to be a Super User!
maybe you can try this
datediff(max(orderdate),max(postingdate),day)
Proud to be a Super User!
Hi Ryan,
This seems to have worked, thank you ever so much!
you are welcome
Proud to be a Super User!
Can you prepare and upload a pbix example with a fake data but the same model?
Thank you
I wouldn't know how to do this sorry.
Hi @AdamD123 ,
you have to create a CALCULATED COLUMN using DIFFDATE() function.
Refer to this documentation:
https://learn.microsoft.com/en-us/dax/datediff-function-dax
Try to use this calculated column formulas.
Column =
DATEDIFF([Order_Date], [Posting_Date], DAY)
Mark as a solution if i help you to resolv your problem
Hello Luca,
Thank you for your reply. I have done this but get the below:
You have to respect the syntax of the code!
Helping with intellisense that suggest you the wright way, put the table name before the comun name.
Something like this:
DATEDIFF(Tablename[Order_Date], Tablename[Posting_Date], DAY)
I think I understand what you are explaining but that is the issue, the one column does not appear to select because they are from different date sets:
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
84 | |
76 | |
73 | |
42 | |
36 |
User | Count |
---|---|
109 | |
56 | |
52 | |
48 | |
42 |