Starting December 3, join live sessions with database experts and the Microsoft product team to learn just how easy it is to get started
Learn moreGet certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now
Hi guys,
Current situation - I have this input table:
Desired situation -
So the idea is that power query transforms the input table:
1) gets the product from product column
2) creates the date column, where the first date is [From] and the last is [To] - and between these dates there are consecutive days
3) each unique combination of [product + price + from + to] appends to each other - oucome is the desired table.
Do you guys think it is possible to perform that transformation in power query?
Solved! Go to Solution.
It is quite easy if you convert the dates to numbers, add a column with nested lists with all numbers representing the from..to dates,
remove the From/To columns, expand the new column and adjust the data type to date.
let Source = InputTable, #"Changed Type" = Table.TransformColumnTypes(Source,{{"From", Int64.Type}, {"To", Int64.Type}}), #"Added Custom" = Table.AddColumn(#"Changed Type", "Date", each {[From]..[To]}), #"Removed Columns" = Table.RemoveColumns(#"Added Custom",{"From", "To"}), #"Expanded Date" = Table.ExpandListColumn(#"Removed Columns", "Date"), #"Changed Type1" = Table.TransformColumnTypes(#"Expanded Date",{{"Date", type date}}) in #"Changed Type1"
It is quite easy if you convert the dates to numbers, add a column with nested lists with all numbers representing the from..to dates,
remove the From/To columns, expand the new column and adjust the data type to date.
let Source = InputTable, #"Changed Type" = Table.TransformColumnTypes(Source,{{"From", Int64.Type}, {"To", Int64.Type}}), #"Added Custom" = Table.AddColumn(#"Changed Type", "Date", each {[From]..[To]}), #"Removed Columns" = Table.RemoveColumns(#"Added Custom",{"From", "To"}), #"Expanded Date" = Table.ExpandListColumn(#"Removed Columns", "Date"), #"Changed Type1" = Table.TransformColumnTypes(#"Expanded Date",{{"Date", type date}}) in #"Changed Type1"
Brilliant, thanks kind sir!
Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.
User | Count |
---|---|
86 | |
85 | |
84 | |
67 | |
49 |
User | Count |
---|---|
131 | |
110 | |
97 | |
71 | |
67 |