Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! 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
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
| User | Count |
|---|---|
| 21 | |
| 10 | |
| 9 | |
| 4 | |
| 4 |
| User | Count |
|---|---|
| 35 | |
| 31 | |
| 20 | |
| 13 | |
| 10 |