March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
Hi,
I have 4 rows of data and what I want is to pull the min and max of the dates.
I currently use the following dax:
Earliest Date =
Calculate (min(test[datetime]), allexcept(test, test[date]))
Latest Date =
Calculate (max(test[datetime]), allexcept(test, test[date]))
This works fine when I just have the 2 records.
The problem I have is when more records come in as it takes the Earliest date from the 1st record and the latest from the 4th record.
What I need is the Earliest date from the first record and latest date from the 2nd record.
Then the earliest date from the 3rd record and the latest date from the 4th record etc.
The problem I have is the 2 rows don't have a linked ID to match them together which makes it difficult.
Long shot but I don't suppose anyone would have an idea how to link based on my logic, maybe index by taking current value and index plus 1? Not sure.
Example data
Index Datetime Earliest. Latest
1 10:30:30. 10:30:30. 10:32:30
2 10:32:30. 10:30:30. 10:32:30
3 10:45:15. 10:45:15. 10:50:10
4 10:50:10. 10:45:15. 10:50:10
Solved! Go to Solution.
Hi @M_SBS_6 ,
I grouped them by Even function and you can check the result as follows:
Even = EVEN([ID])
Earliest Date = var _t =ADDCOLUMNS('Table',"Earliest Date",MINX(FILTER(ALL('Table'),[Even]=EARLIER([Even])),[DateTime]))
RETURN MINX(_t,[Earliest Date])
Latest Date = var _t =ADDCOLUMNS('Table',"Latest Date",MAXX(FILTER(ALL('Table'),[Even]=EARLIER([Even])),[DateTime]))
RETURN MAXX(_t,[Latest Date])
An attachment for your reference. Hope it helps!
Best regards,
Community Support Team_ Scott Chang
If this post helps then please consider Accept it as the solution to help the other members find it more quickly.
Hi @M_SBS_6 ,
I grouped them by Even function and you can check the result as follows:
Even = EVEN([ID])
Earliest Date = var _t =ADDCOLUMNS('Table',"Earliest Date",MINX(FILTER(ALL('Table'),[Even]=EARLIER([Even])),[DateTime]))
RETURN MINX(_t,[Earliest Date])
Latest Date = var _t =ADDCOLUMNS('Table',"Latest Date",MAXX(FILTER(ALL('Table'),[Even]=EARLIER([Even])),[DateTime]))
RETURN MAXX(_t,[Latest Date])
An attachment for your reference. Hope it helps!
Best regards,
Community Support Team_ Scott Chang
If this post helps then please consider Accept it as the solution to help the other members find it more quickly.
please provide the expected solution to your sample data so one is sure what one is testing, is this the exact format of the data?
Proud to be a Super User!
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
111 | |
77 | |
54 | |
53 | |
44 |
User | Count |
---|---|
183 | |
119 | |
77 | |
65 | |
56 |