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.
I need in editor add column which must found currency value at operation date, if currency value not exists on operation date, then take last nearest date value
Table1
Date | AddColumn
2020-01-01 |
2020-01-05 |
Table2
Date | Currency | Value
2020-01-01 | USD | 0.8124545
2020-01-03 | USD | 0.8524545
2020-01-06 | USD | 0.8924545
expected result
Table1
Date | AddColumn
2020-01-01 | 0.8124545
2020-01-05 | 0.8524545
Solved! Go to Solution.
@Analitika , Try a new column table 1
New column =
var _excat = maxx(filter(Table2, Table1[Date] = Table2[Date] ),Table2[Value])
var _min = datediff(Table1[Date], maxx(filter(Table2, Table1[Date] < Table2[Date] ),Table1[Date]),day)
var _max = datediff(Table1[Date],minx(filter(Table2, Table1[Date] > Table2[Date] ),Table1[Date]),day)
return
if(not(isblank(_excat)),_excat, if(abs(_min) <abs(_max),maxx(filter(Table2, Table2[Date] =_min ),Table2[Value]),,maxx(filter(Table2, Table2[Date] =_max ),Table2[Value])))
@Analitika , Try a new column table 1
New column =
var _excat = maxx(filter(Table2, Table1[Date] = Table2[Date] ),Table2[Value])
var _min = datediff(Table1[Date], maxx(filter(Table2, Table1[Date] < Table2[Date] ),Table1[Date]),day)
var _max = datediff(Table1[Date],minx(filter(Table2, Table1[Date] > Table2[Date] ),Table1[Date]),day)
return
if(not(isblank(_excat)),_excat, if(abs(_min) <abs(_max),maxx(filter(Table2, Table2[Date] =_min ),Table2[Value]),,maxx(filter(Table2, Table2[Date] =_max ),Table2[Value])))
TY, it works with some addition correction, as you in return use _max but need date
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 |
---|---|
107 | |
97 | |
75 | |
65 | |
53 |
User | Count |
---|---|
144 | |
103 | |
98 | |
85 | |
64 |