Don't miss your chance to take the Fabric Data Engineer (DP-600) exam for FREE! Find out how by watching the DP-600 session on-demand now through April 28th.
Learn moreJoin the FabCon + SQLCon recap series. Up next: Power BI, Real-Time Intelligence, IQ and AI, and Data Factory take center stage. All sessions are available on-demand after the live show. Register now
Hi there !!
I am wanting to add a column to my table and in this column I want to obtain the value that it gives me in the last date filtered with id.
I have an id column, a value column, a date column, and I want the new column to give me the value that is the most recent date. something like that:
:
I want to get the last column. of the id B34001 its last date was 07/12/2020 and for that date the value ea 0.96 so in my new column I want that in all the id B34001 I get 0.96.
I have this:
but now in the table they are slipping me some blank value. then I have as the last date the blank value and when I do the query I get the last blank value. How can I make it so that I don't get the last blank values? You should use LASTNONBLANK somewhere in the query but I don't know where.
Thanks in advance
regards
Solved! Go to Solution.
You can try this column expression, replacing Table with your actual table name.
Ultimo Valor = CALCULATE(LASTNONBLANKVALUE(Table[fecha], MAX(Table[valor])), ALLEXCEPT(Table, Table[id))
Pat
To learn more about Power BI, follow me on Twitter or subscribe on YouTube.
Hello @Anonymous
if you are looking for a solution in Power Query then you can use Table.Group and group by id and apply to function. One to get the whole grouped table and the other is to calculate the value in the last date of "fecha". Here an example
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WcjJU0lEyMNQDIiMDEFPH0kwpVgdVwhCrhDG6DiMMoywwJECaDVFFoeYYGugYQSSMUc0xxhAFGWKKKgo3RCk2FgA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [id = _t, fecha = _t, Value = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"id", type text}, {"fecha", type date}, {"Value", type number}}, "de-DE"),
#"Grouped Rows" = Table.Group(#"Changed Type", {"id"}, {{"AllRows", each _, type table [id=text, fecha=date, Column1=number]}, {"MaxValue", each Table.Max(_,"fecha")[Value], type number}}),
#"Expanded AllRows" = Table.ExpandTableColumn(#"Grouped Rows", "AllRows", {"fecha"}, {"fecha"})
in
#"Expanded AllRows"
Copy paste this code to the advanced editor in a new blank query to see how the solution works.
If this post helps or solves your problem, please mark it as solution (to help other users find useful content and to acknowledge the work of users that helped you)
Kudoes are nice too
Have fun
Jimmy
if you are satisfied with a solution in power query and upload an example table that is copyable, II can try to search for what you ask
You can try this column expression, replacing Table with your actual table name.
Ultimo Valor = CALCULATE(LASTNONBLANKVALUE(Table[fecha], MAX(Table[valor])), ALLEXCEPT(Table, Table[id))
Pat
To learn more about Power BI, follow me on Twitter or subscribe on YouTube.
Check out the April 2026 Power BI update to learn about new features.
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.
| User | Count |
|---|---|
| 3 | |
| 3 | |
| 2 | |
| 2 | |
| 2 |
| User | Count |
|---|---|
| 5 | |
| 4 | |
| 4 | |
| 4 | |
| 4 |