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.
New to DAX. Table X has many records let's say for October 1, 2020 with date/time.
I am trying to get the MAX date from table X that has a start date >= Table Y -30/1440 and start date <= Table Y + 5/1440.
So table Y also has many records for date/time on October 1, 2020. Tables X and Y are unrelated.
Example:
Table X
10/01/2020 12:50:00 AM |
10/01/2020 02:27:23 AM |
10/01/2020 02:34:37 AM |
10/01/2020 03:57:35 AM |
10/01/2020 05:20:58 AM |
Table Y
10/1/20 12:46 AM | 10/1/20 2:23 AM |
10/1/20 2:31 AM | 10/1/20 3:54 AM |
10/1/20 3:54 AM | 10/1/20 5:17 AM |
10/1/20 5:17 AM | 10/1/20 6:51 AM |
10/1/20 6:51 AM | 10/1/20 8:09 AM |
So Table Y has 10/1/20 12:46 AM and 10/1/20 2:23 AM (12:46 AM is used for the calculation). So the MAX date out of Table X that falls between the red values is 10/01/2020 12:50:00 AM.
The jist is that for a given date, I want to get the max date out of a range in another (unrelated) table using said given date. I know this is confusing.
Can't figure out a way to do this or if its even possible. Any thoughts?
Assuming you're doing the calculation in context of Table Y then?
For example, as a new COLUMN in tableY:
TableXDate = MAXX(FILTER(TableX, TableX[Date] >= TableY[Date] -30/1440 && TableX[Date] <= TableY[Date] + 5/1440), TableX[Date])
Copying DAX from this post? Click here for a hack to quickly replace it with your own table names
Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C
I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com
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 |
---|---|
43 | |
21 | |
20 | |
15 | |
13 |
User | Count |
---|---|
45 | |
41 | |
39 | |
19 | |
19 |