Don't miss your chance to take the Fabric Data Engineer (DP-600) exam for FREE! Find out how by attending the DP-600 session on April 23rd (pacific time), live or on-demand.
Learn moreNext up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now
Hello
Could you please help me to create this condition index column see the example
Name Index
A 1
B
C
A 2
B
A 3
A 4
Solved! Go to Solution.
Hi @RENJITH_R_S
Download sample PBIX file with this code.
This works in Power Query
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WclSK1YlWcgKTzmASWcQRRsYCAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Name = _t]),
#"Added Index" = Table.AddIndexColumn(Source, "Index", 1, 1, Int64.Type),
#"Added Custom" = Table.AddColumn(#"Added Index", "Custom", each if [Name] = "A" then List.Count(List.Select(List.FirstN(#"Added Index"[Name], [Index]), each _ = "A")) else ""),
#"Removed Columns" = Table.RemoveColumns(#"Added Custom",{"Index"})
in
#"Removed Columns"
I'll see if I can do it in DAX too.
Regards
Phil
Proud to be a Super User!
Hi @RENJITH_R_S
Download sample PBIX file with this code.
This works in Power Query
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WclSK1YlWcgKTzmASWcQRRsYCAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Name = _t]),
#"Added Index" = Table.AddIndexColumn(Source, "Index", 1, 1, Int64.Type),
#"Added Custom" = Table.AddColumn(#"Added Index", "Custom", each if [Name] = "A" then List.Count(List.Select(List.FirstN(#"Added Index"[Name], [Index]), each _ = "A")) else ""),
#"Removed Columns" = Table.RemoveColumns(#"Added Custom",{"Index"})
in
#"Removed Columns"
I'll see if I can do it in DAX too.
Regards
Phil
Proud to be a Super User!
Hello
And what would it be like if I wanted him to tell me all the lyrics? For example, when sorting the names, it would look like this:
A 1
A 2
A 3
A 4
B 1
B 2
C 1
In advance thank you very much!
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.
| User | Count |
|---|---|
| 48 | |
| 40 | |
| 37 | |
| 20 | |
| 16 |
| User | Count |
|---|---|
| 70 | |
| 67 | |
| 32 | |
| 27 | |
| 25 |