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.
Hola, me gustaría obtener el efecto como se indica a continuación, el valor se calcula en función de los dos id de las dos primeras columnas.
identificación | second_id | contar |
a | 1 | 1 |
a | 1 | 2 |
a | 1 | 3 |
a | 2 | 1 |
b | 1 | 1 |
b | 2 | 1 |
b | 2 | 2 |
b | 2 | 3 |
c | 1 | 1 |
Solved! Go to Solution.
agregar una columna de índice en la consulta de energía https://stackoverflow.com/questions/45715963/creating-an-index-column-for-power-bi
A continuación, pruebe una nueva columna en dax
countx=countx(filter(Table, [id] =earlier([id]) && [second_id] =earlier([second_id]) && [index] <= earlier([index]) ), [index])
puede hacerlo en Power Query de la siguiente manera:
// Table (2)
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WSlTSUTJUitXBzTICs5LgYkkoYuisZIi6WAA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [id = _t, second_id = _t]),
#"Added Index" = Table.AddIndexColumn(Source, "Index", 0, 1, Int64.Type),
#"Merged Queries" = Table.NestedJoin(#"Added Index", {"Index"}, Table, {"Index.1"}, "Table", JoinKind.LeftOuter),
#"Expanded Table" = Table.ExpandTableColumn(#"Merged Queries", "Table", {"Index"}, {"Index.1"}),
#"Removed Columns" = Table.RemoveColumns(#"Expanded Table",{"Index"})
in
#"Removed Columns"
// Table
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WSlTSUTJUitXBzTICs5LgYkkoYuisZIi6WAA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [id = _t, second_id = _t]),
#"Inserted Merged Column" = Table.AddColumn(Source, "Merged", each Text.Combine({[id], Text.From([second_id], "de-DE")}, ""), type text),
#"Grouped Rows" = Table.Group(#"Inserted Merged Column", {"Merged"}, {{"Count", each _, type table [id=nullable text, second_id=nullable number, count=nullable number, Merged=text]}}),
#"Added Custom" = Table.AddColumn(#"Grouped Rows", "Custom", each Table.AddIndexColumn([Count], "Index", 1, 1, Int64.Type)),
#"Expanded Custom" = Table.ExpandTableColumn(#"Added Custom", "Custom", {"Index"}, {"Index"}),
#"Removed Columns" = Table.RemoveColumns(#"Expanded Custom",{"Count"}),
#"Changed Type1" = Table.TransformColumnTypes(#"Removed Columns",{{"Index", Int64.Type}}),
#"Added Index" = Table.AddIndexColumn(#"Changed Type1", "Index.1", 0, 1, Int64.Type)
in
#"Added Index"
Con amables saludos desde la ciudad donde la leyenda del 'Pied Piper de Hamelin' está en casa
FrankAT (Orgulloso de ser un Datanaut)
agregar una columna de índice en la consulta de energía https://stackoverflow.com/questions/45715963/creating-an-index-column-for-power-bi
A continuación, pruebe una nueva columna en dax
countx=countx(filter(Table, [id] =earlier([id]) && [second_id] =earlier([second_id]) && [index] <= earlier([index]) ), [index])
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 |
---|---|
2 | |
1 | |
1 | |
1 | |
1 |
User | Count |
---|---|
2 | |
2 | |
2 | |
2 | |
1 |