Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.
Hi,
I have a dataset (much larger and not filtered however) which looks like the following:
Event Date | ID |
26/07/2016 | 7076341 |
26/07/2016 | 7055292 |
2/08/2016 | 7055292 |
20/09/2016 | 7076341 |
25/10/2016 | 7076341 |
22/11/2016 | 7076341 |
16/12/2016 | 7076341 |
23/12/2016 | 7311257 |
I need to calculate the days between the first and last date for each unique ID. The formula might also need to check if an ID has two dates or not.
I've explored a few ideas but am not that confident in DAX.
Thanks in advance for your help,
Solved! Go to Solution.
HI @redbrumby
This calculated table may give you want you want. I have attached a simple PBIX file
Table = SUMMARIZECOLUMNS( 'Table1'[ID] , "Min Date" , MIN('Table1'[Event Date]) , "Max Date" , MAX('Table1'[Event Date]) , "Date Diff" , DATEDIFF( MIN('Table1'[Event Date]), MAX('Table1'[Event Date]),DAY) )
Hi,
i dragged ID to the rows labels of the Table visual and wrote the following measure
Diff = 1*(MAX(Data[Event Date])-MIN(Data[Event Date]))
Hope this helps.
HI @redbrumby
This calculated table may give you want you want. I have attached a simple PBIX file
Table = SUMMARIZECOLUMNS( 'Table1'[ID] , "Min Date" , MIN('Table1'[Event Date]) , "Max Date" , MAX('Table1'[Event Date]) , "Date Diff" , DATEDIFF( MIN('Table1'[Event Date]), MAX('Table1'[Event Date]),DAY) )
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.
Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.
User | Count |
---|---|
143 | |
85 | |
66 | |
51 | |
45 |
User | Count |
---|---|
216 | |
89 | |
82 | |
66 | |
57 |