Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

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.

Reply
Syndicate_Admin
Administrator
Administrator

contar si

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ónsecond_idcontar
a11
a12
a13
a21
b11
b21
b22
b23
c11

1 ACCEPTED SOLUTION
Syndicate_Admin
Administrator
Administrator

@wiktorius1984 ,


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])

View solution in original post

2 REPLIES 2
Syndicate_Admin
Administrator
Administrator

No @wiktorius1984,

puede hacerlo en Power Query de la siguiente manera:

12-05-_2021_17-17-36.png

// 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)

Syndicate_Admin
Administrator
Administrator

@wiktorius1984 ,


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])

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.