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 moreGet certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now
Hi Guys,
Please help me out,
I am providing sample data for you, Here the output should be as Next Index column using PQE.
Thanks in Advacne.
number | Index | Next Index | |
100 | 1 | 2 | |
100 | 2 | 3 | |
100 | 3 | ||
20 | 1 | 2 | |
20 | 2 | ||
150 | 1 | 2 | |
150 | 2 | 3 | |
150 | 3 | 4 | |
150 | 4 | 5 | |
150 | 5 | ||
10 | 1 |
Solved! Go to Solution.
hello, @sravani9920
let
Source = your_table,
f = (tbl) =>
[new_col = List.Skip(tbl[Index]) & {null},
out = Table.FromColumns(
Table.ToColumns(tbl) & {new_col},
Table.ColumnNames(tbl) & {"Next Index"}
)][out],
g = Table.Group(Source, "number", {"data", f}),
z = Table.Combine(g[data])
in
z
Hi @sravani9920, different approach.
Result:
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjQwUNJRMlSK1YGxjZDYxmC2EUKJEZIKUySdpujixkhsEyS2KdR0iNZYAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [number = _t, Index = _t]),
Ad_NewIndex = Table.Combine(Table.Group(Source, {"number"}, {{"t", each Table.AddColumn(_, "New Index", (x)=> if Number.From(x[Index]) <> Table.RowCount(_) then Number.From(x[Index]) +1 else null, Int64.Type), type table}})[t])
in
Ad_NewIndex
hello, @sravani9920
let
Source = your_table,
f = (tbl) =>
[new_col = List.Skip(tbl[Index]) & {null},
out = Table.FromColumns(
Table.ToColumns(tbl) & {new_col},
Table.ColumnNames(tbl) & {"Next Index"}
)][out],
g = Table.Group(Source, "number", {"data", f}),
z = Table.Combine(g[data])
in
z
Thank You AlienSX, This was worked.
Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.
User | Count |
---|---|
35 | |
16 | |
12 | |
11 | |
9 |
User | Count |
---|---|
45 | |
25 | |
16 | |
14 | |
14 |