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.
I have this table. In multiple days
I would need to know what was the last parameter of the table by deposit.
final example:
In different oil tanks the pH and acidity parameters are measured every 5 days, and saved in a table (capture 1), you would need a table, measure, or filter that tells me the last values that was taken in that tank. A table that would finally show the last date for each deposit of those parameters.
En distintos depósitos de aceite se mide cada 5 días los parámetros de acidez y ph, y se guarda en una tabla (captura 1) necesitaría una tabla, medida, o filtro que me indique los últimos valores que se tomó en ese depósito. Una tabla que mostraría finalmente la última fecha por cada depósito de esos parámetros ph y acidez.
Solved! Go to Solution.
The M code you need is this one:
let Origen = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("fZDNCoAgEITfxbOQu/7Vs0SHqKBunXv6HOnPREHE5ZuZdbfvhSIhxTht83KEBwpFTTisyItBXoJ9DRcDcg5ft7SQ6FTCt98AmgLUgDaHT3js7mrRvuJuIWgL7jh1V/kYqRTq/86IckF0oy9xATpAXYnGWPTZ2HAC", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [deposito = _t, parametro = _t, valor = _t, fecha = _t]), #"Tipo cambiado" = Table.TransformColumnTypes(Origen,{{"deposito", Int64.Type}, {"parametro", type text}, {"valor", type number}, {"fecha", type date}}), #"Grouped Rows" = Table.Group(#"Tipo cambiado", {"deposito", "parametro"}, {{"fecha", each List.Max([fecha]), type date}}), JoinTbls = Table.NestedJoin(#"Grouped Rows", {"deposito","fecha","parametro"}, #"Tipo cambiado", {"deposito","fecha","parametro"}, "TblToExp", JoinKind.Inner), #"Expanded TblToExp" = Table.ExpandTableColumn(JoinTbls, "TblToExp", {"valor"}, {"valor"}) in #"Expanded TblToExp"
Did I answer your question correctly? Mark my answer as a solution!
Proud to be a Datanaut!
Hola @Pakovich
I see you are ysing Power Query. You basically have to perform 3 steps:
1) Group by deposito, parametro and get the Max of fecha
2) Join the table in step 1 with the original table by Deposite, Parametro and Fecha
3) expand the table column created in step 2, only choosing Valor
if you post a copiable version of the table, the Power Query code could be provided
Did I answer your question correctly? Mark my answer as a solution!
Proud to be a Datanaut!
hi @LivioLanzo thank you very much. Here the pbix link, a copiable version of the table
https://drive.google.com/file/d/1B5rhR4O8zBr6Y4cLdKnTBzeofUZuiwZe/view?usp=sharing
The M code you need is this one:
let Origen = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("fZDNCoAgEITfxbOQu/7Vs0SHqKBunXv6HOnPREHE5ZuZdbfvhSIhxTht83KEBwpFTTisyItBXoJ9DRcDcg5ft7SQ6FTCt98AmgLUgDaHT3js7mrRvuJuIWgL7jh1V/kYqRTq/86IckF0oy9xATpAXYnGWPTZ2HAC", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [deposito = _t, parametro = _t, valor = _t, fecha = _t]), #"Tipo cambiado" = Table.TransformColumnTypes(Origen,{{"deposito", Int64.Type}, {"parametro", type text}, {"valor", type number}, {"fecha", type date}}), #"Grouped Rows" = Table.Group(#"Tipo cambiado", {"deposito", "parametro"}, {{"fecha", each List.Max([fecha]), type date}}), JoinTbls = Table.NestedJoin(#"Grouped Rows", {"deposito","fecha","parametro"}, #"Tipo cambiado", {"deposito","fecha","parametro"}, "TblToExp", JoinKind.Inner), #"Expanded TblToExp" = Table.ExpandTableColumn(JoinTbls, "TblToExp", {"valor"}, {"valor"}) in #"Expanded TblToExp"
Did I answer your question correctly? Mark my answer as a solution!
Proud to be a Datanaut!
¡Wow! Thank you very much. It's right
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 |
---|---|
110 | |
94 | |
82 | |
66 | |
58 |
User | Count |
---|---|
151 | |
121 | |
104 | |
87 | |
67 |