Starting December 3, join live sessions with database experts and the Microsoft product team to learn just how easy it is to get started
Learn moreShape the future of the Fabric Community! Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions. Take survey.
in the attched excel there are two sheets (Activity code 2 & dates ) , activtity code 2 column i need to make a lookup function on true basis of dates id ,
as i used lookup function its showing like this, showing exact match , but i need like in excel we can used true /false , so here need to use true to show nearest dates id against each date.https://alfanargroup-my.sharepoint.com/:x:/g/personal/bilal_nawaz_alfanar_com/EZyYQnQmxYRAq8oAw4ZArK...
Solved! Go to Solution.
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("vVnbcqM4EP0VVZ52q8KOuBoeCVYcHHNZwOOpmp0H4rCJNx6c9WW25u+3BTRYGI8Th+RBp4hS9DmI7tYR/vr1YiRR+eLyYpTl2TpdwlXIJMVQ4CJirn8dRA7zmJ+Q4JokN9OZPSFJMPMByK09jRNJIU7g+8xJ3MAnl2M2HNo35BLmksh2EnJnx2zi+ozEzg0bTicMAsvVUExpnOaSQhX94tvl1ws2lCgnZvnDIs+y9SJ/IH/tKFUMMsw2i4f8Q9QpOAbSMJtzdWqpzpOoyhWsV/PdOvue5VvyG/t3t3jmlxtU6qVbUJ4uN79/iFq1GrIujXdLrlYr1DoS1WDaWeWb7Xo33y5WH7N6WjUUBfTkjR43lKgO8y7oSZfLlAsi4WO6yT5Ell4Nqkv27qGRlcA6GTCfZJvtXro5q+/fFxuQCHMfos+ohiyL+kLQNyiT7p9sviXOcrXJVrvth4gaVEOxRFEjIKaHPYO28o2s/iZufr+DCagHMl9sfxKFbFckTvP0LluSqzgkV+n8afcMC57nWXHXJRln9/fpIwQzqwF9wkvXQp8o2U42it4lWdWQLUzvsjl4yPbq7tC7RJnWIIsdzOmgez8Zcg2HraDkO94L+lej1KAedICS7wUtoH9ZKgI1pGC+FQq/TqjOyu9fi4YA9S5oGfkHxa5xzUl6t3siwyh0ig2oBkvyVz+a25n/glLtCGggUBXrv1qbiAf8c+qGRcfD0rITFrnQ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EgyIaooyx97Ujp965jgNDh7Eq6k32hd00mAuy8gstzJnGTKh1b7ztosRDahT1iYHtMXvKi7TPbXZuzKl8UnXif7YioKtDAPxNYSmLz7f52Zt/ALcXXvwKojB+vmjOZ+ZIf0c6mlhFo67TrlTQYu/aJSN9YybdKUBCaX72auizDdtjLs+lUBLnlx3j5HYZ9K52GoFLx6eo9uIz9gg9/Z2vQEZSBaDZCZN8vqsYbn01oIAgJ/e1/", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Activity_Code_2 = _t, Code_2_Desc = _t, Project_Number = _t, #"142" = _t, #"event id" = _t, Index = _t, #"Max Date" = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Max Date", type date}}),
#"Added Custom" = Table.AddColumn(#"Changed Type", "Closest Date", (k)=> Table.Sort(Table.AddColumn(Dates,"diff",each Number.Abs(Number.From([Date]-k[Max Date]))),{{"diff", Order.Ascending}}){0}[Date]),
#"Added Custom1" = Table.AddColumn(#"Added Custom", "Exact Match", (k)=> try Table.SelectRows(Dates,each [Date]=k[Max Date]){0}[Date] otherwise null)
in
#"Added Custom1"
see attached.
like in excel if we used vlookup and its show two type of result , false/ true or approx match , here i need true or approx match .
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("vVnbcqM4EP0VVZ52q8KOuBoeCVYcHHNZwOOpmp0H4rCJNx6c9WW25u+3BTRYGI8Th+RBp4hS9DmI7tYR/vr1YiRR+eLyYpTl2TpdwlXIJMVQ4CJirn8dRA7zmJ+Q4JokN9OZPSFJMPMByK09jRNJIU7g+8xJ3MAnl2M2HNo35BLmksh2EnJnx2zi+ozEzg0bTicMAsvVUExpnOaSQhX94tvl1ws2lCgnZvnDIs+y9SJ/IH/tKFUMMsw2i4f8Q9QpOAbSMJtzdWqpzpOoyhWsV/PdOvue5VvyG/t3t3jmlxtU6qVbUJ4uN79/iFq1GrIujXdLrlYr1DoS1WDaWeWb7Xo33y5WH7N6Wj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uvbEAVzJPU4hADfmAMR3niuRPYzwKfxWW48r+wj8dJNC2P+sE18dmMxME0uWGRT1ST3n7mhwFOoiHQun0ZmAwiUxix0I5sHvI8Kh0BvI3QFSCby1hgrFyfgYeH7dn2h2TIYnd0JpuBAGkjtEAPY9XHBU5VHybOYxsg0NazQQgMdpDuryUxEajW6up+XAWDq8SeTN7wliyExs1X9VHWg1NFRBvFF6/jxPFKWp0i0PqTsIHlU+Vhp4F6NZGM0E54qCQIxkuhrilk0DoY2JfQ9uPqj8S+Cqa3DRH2jnJiOL2yyShizEcRCoKsdVSd9uuq612NiiCbHYWpnd5m3kGThgAWQnTUUYBL1DoIvYcMHaH4mr1s13X3B/Z30GEgyIaooyx97Ujp965jgNDh7Eq6k32hd00mAuy8gstzJnGTKh1b7ztosRDahT1iYHtMXvKi7TPbXZuzKl8UnXif7YioKtDAPxNYSmLz7f52Zt/ALcXXvwKojB+vmjOZ+ZIf0c6mlhFo67TrlTQYu/aJSN9YybdKUBCaX72auizDdtjLs+lUBLnlx3j5HYZ9K52GoFLx6eo9uIz9gg9/Z2vQEZSBaDZCZN8vqsYbn01oIAgJ/e1/", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Activity_Code_2 = _t, Code_2_Desc = _t, Project_Number = _t, #"142" = _t, #"event id" = _t, Index = _t, #"Max Date" = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Max Date", type date}}),
#"Added Custom" = Table.AddColumn(#"Changed Type", "Closest Date", (k)=> Table.Sort(Table.AddColumn(Dates,"diff",each Number.Abs(Number.From([Date]-k[Max Date]))),{{"diff", Order.Ascending}}){0}[Date]),
#"Added Custom1" = Table.AddColumn(#"Added Custom", "Exact Match", (k)=> try Table.SelectRows(Dates,each [Date]=k[Max Date]){0}[Date] otherwise null)
in
#"Added Custom1"
see attached.
User | Count |
---|---|
25 | |
21 | |
20 | |
13 | |
13 |
User | Count |
---|---|
40 | |
28 | |
27 | |
23 | |
21 |