Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
Sign up nowGet Fabric certified for FREE! Don't miss your chance! Learn more
Hi have 2 columns, how can i know the name of column and date for most recent date for the product.
Exemple: product 1 is column B with 20-07-2020
product 2 is column A with 3-2-2019
| Product | A | B |
| 1 | 10-07-2020 | 20-07-2020 |
| 2 | 3-2-2019 | 01-12-2018 |
Solved! Go to Solution.
@paulomoreira
Create a blank Query, go to the Advanced Editor, clear the existing code, and paste the codes give below and follow the steps.
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMlTSUTI00DUw1zUyMDIAcowQnFidaCUjoJCxrhFQwNASyDQw1DUEcyyUYmMB", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Product = _t, A = _t, B = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"A", type date}, {"B", type date}},"en-gb"),
#"Added Custom" = Table.AddColumn(#"Changed Type", "Recent Date", each List.Max({[A],[B]})),
#"Changed Type1" = Table.TransformColumnTypes(#"Added Custom",{{"Recent Date", type date}}),
#"Added Custom1" = Table.AddColumn(#"Changed Type1", "Column Name", each let
i = {[A],[B]}
in
Table.ColumnNames(#"Changed Type")
{ List.PositionOf(i,[Recent Date]) + 1})
in
#"Added Custom1"
________________________
If my answer was helpful, please click Accept it as the solution to help other members find it useful
Click on the Thumbs-Up icon if you like this reply 🙂
⭕ Subscribe and learn Power BI from these videos
⚪ Website ⚪ LinkedIn ⚪ PBI User Group
@paulomoreira
DAX doesn't support retrieving the column name or any meta data, you can do it in Power Query if you like.
________________________
If my answer was helpful, please click Accept it as the solution to help other members find it useful
Click on the Thumbs-Up icon if you like this reply 🙂
⭕ Subscribe and learn Power BI from these videos
⚪ Website ⚪ LinkedIn ⚪ PBI User Group
How can i do with M?
@paulomoreira
Create a blank Query, go to the Advanced Editor, clear the existing code, and paste the codes give below and follow the steps.
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMlTSUTI00DUw1zUyMDIAcowQnFidaCUjoJCxrhFQwNASyDQw1DUEcyyUYmMB", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Product = _t, A = _t, B = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"A", type date}, {"B", type date}},"en-gb"),
#"Added Custom" = Table.AddColumn(#"Changed Type", "Recent Date", each List.Max({[A],[B]})),
#"Changed Type1" = Table.TransformColumnTypes(#"Added Custom",{{"Recent Date", type date}}),
#"Added Custom1" = Table.AddColumn(#"Changed Type1", "Column Name", each let
i = {[A],[B]}
in
Table.ColumnNames(#"Changed Type")
{ List.PositionOf(i,[Recent Date]) + 1})
in
#"Added Custom1"
________________________
If my answer was helpful, please click Accept it as the solution to help other members find it useful
Click on the Thumbs-Up icon if you like this reply 🙂
⭕ Subscribe and learn Power BI from these videos
⚪ Website ⚪ LinkedIn ⚪ PBI User Group
If you love stickers, then you will definitely want to check out our Community Sticker Challenge!
Check out the January 2026 Power BI update to learn about new features.
| User | Count |
|---|---|
| 7 | |
| 4 | |
| 4 | |
| 3 | |
| 2 |
| User | Count |
|---|---|
| 15 | |
| 9 | |
| 8 | |
| 7 | |
| 5 |