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, tengo un origen de datos que tiene una columna con Store_ID, fecha y estado:
STORE_ID | Fecha | Estado |
A1 | 01/01 | No activado |
A1 | 01/01 | Activado |
B1 | 01/01 | Activado |
C2 | 01/02 | No activado |
Como puede ver, puede haber dos estados para el mismo STORE_ID en la misma FECHA... Dado que para mis medidas hago DISTINCTCOUNT en tiendas, es inútil para mí cargar row1 (A1 - No Activado) en mi .pbix porque también lo tengo activado ese día. PERO si sólo no está activado ese día (última fila, por ejemplo), quiero mantenerlo en mi tabla.
¿Hay alguna manera de filtrar esta tabla en POWER QUERY EDITOR para que mis datos .pbix sean mucho más pequeños y lo hagan más rápido? Quiero hacer esto porque mis datos son enormes y podría filtrar eso.
¡Gracias!
Solved! Go to Solution.
Hola @jorgeslzr ,
Puede editar los códigos aplicados en el Editor avanzado para lograrlo:
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WcjRU0lEyMjAy0DfUBzH98ksUEpNLMssSS1JTlGJ1MFU4osg64ZV1NkLIGmGaHgsA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [STORE_ID = _t, DATE = _t, STATUS = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"STORE_ID", type text}, {"DATE", type date}, {"STATUS", type text}}),
#"Grouped Rows" = Table.Group(#"Changed Type", {"DATE", "STORE_ID"}, {{"Count", each Table.RowCount(Table.Distinct(_)), Int64.Type}, {"Details", each _, type table [STORE_ID=nullable text, DATE=nullable date, STATUS=nullable text]}}),
#"Expanded Details" = Table.ExpandTableColumn(#"Grouped Rows", "Details", {"STATUS"}, {"Details.STATUS"}),
#"Filtered Rows" = Table.SelectRows(#"Expanded Details", each ([Details.STATUS] = "Not activated") and ([Count] = 1))
in
#"Filtered Rows"
También puede consultar el siguiente blog para lograrlo:
Agrupación en Power Query; Obtener el último elemento en cada grupo
Saludos
Rena
Hola @jorgeslzr ,
Puede editar los códigos aplicados en el Editor avanzado para lograrlo:
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WcjRU0lEyMjAy0DfUBzH98ksUEpNLMssSS1JTlGJ1MFU4osg64ZV1NkLIGmGaHgsA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [STORE_ID = _t, DATE = _t, STATUS = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"STORE_ID", type text}, {"DATE", type date}, {"STATUS", type text}}),
#"Grouped Rows" = Table.Group(#"Changed Type", {"DATE", "STORE_ID"}, {{"Count", each Table.RowCount(Table.Distinct(_)), Int64.Type}, {"Details", each _, type table [STORE_ID=nullable text, DATE=nullable date, STATUS=nullable text]}}),
#"Expanded Details" = Table.ExpandTableColumn(#"Grouped Rows", "Details", {"STATUS"}, {"Details.STATUS"}),
#"Filtered Rows" = Table.SelectRows(#"Expanded Details", each ([Details.STATUS] = "Not activated") and ([Count] = 1))
in
#"Filtered Rows"
También puede consultar el siguiente blog para lograrlo:
Agrupación en Power Query; Obtener el último elemento en cada grupo
Saludos
Rena
En función de la descripción que enviaste, supongo que siempre obtienes el último estado basado en el campo de fecha (que debe tener tiempo también).
En la consulta de energía debe hacer alguna clasificación y, a continuación, seleccionar los valores más recientes.
Puede ver los siguientes 2 enlaces:
https://blog.crossjoin.co.uk/2015/05/11/nested-calculations-in-power-query/
https://www.excelguru.ca/blog/2018/06/14/ranking-method-choices-in-power-query/
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 |
---|---|
1 | |
1 | |
1 | |
1 | |
1 |