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.
Hi,
I have 2 tables and would like to match the record with the nearest date.
table 1:
table 2:
expected result:
thanks
Solved! Go to Solution.
pls try this
Column =
VAR _l=maxx(FILTER('Table 2','Table'[item]='Table 2'[item]&&'Table'[end time]>='Table 2'[last_dt]),'Table 2'[last_dt])
VAR _n=minx(FILTER('Table 2','Table'[item]='Table 2'[item]&&'Table'[end time]<'Table 2'[last_dt]),'Table 2'[last_dt])
VAR _d1='Table'[end time]-_l
VAR _d2=abs(_n-'Table'[end time])
VAR _compare=min(_d1,_d2)
return if(_compare=_d1,maxx(FILTER('Table 2','Table'[item]='Table 2'[item]&&'Table 2'[last_dt]=_l),'Table 2'[value]),maxx(FILTER('Table 2','Table'[item]='Table 2'[item]&&'Table 2'[last_dt]=_n),'Table 2'[value]))
pls see the attachment below
Proud to be a Super User!
pls try this
Column =
VAR _l=maxx(FILTER('Table 2','Table'[item]='Table 2'[item]&&'Table'[end time]>='Table 2'[last_dt]),'Table 2'[last_dt])
VAR _n=minx(FILTER('Table 2','Table'[item]='Table 2'[item]&&'Table'[end time]<'Table 2'[last_dt]),'Table 2'[last_dt])
VAR _d1='Table'[end time]-_l
VAR _d2=abs(_n-'Table'[end time])
VAR _compare=min(_d1,_d2)
return if(_compare=_d1,maxx(FILTER('Table 2','Table'[item]='Table 2'[item]&&'Table 2'[last_dt]=_l),'Table 2'[value]),maxx(FILTER('Table 2','Table'[item]='Table 2'[item]&&'Table 2'[last_dt]=_n),'Table 2'[value]))
pls see the attachment below
Proud to be a Super User!
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 |
---|---|
111 | |
96 | |
80 | |
68 | |
59 |
User | Count |
---|---|
150 | |
119 | |
104 | |
87 | |
67 |