Forum Discussion
Anonymous
7 years agoNot applicable
Simulate monthly payments using List.Dates
Dear BI Community, I have a challanging problem that I would love to get some help with. I have a table called Salaries with the salaries of each employee at the company with columns indicating t...
v-xuding-msft
Community Support
7 years agoHi Anonymous ,
By my test, you could create a new table and then merge it with table1. However, if you have a lot of data, the method will be complicated.
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45Wcs0tyMmvTE1V0lHyzc8rycipVAhOzEksqgQKBJckFpUouCSWgGRd81IgzFgdhC4FQ6CMiQEQAGkjA0NLXQNDIIJxDI10jQ1RNRgB5YxNkTVY6BpagjlGBroGprpG5kqxsQA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [#"(blank)" = _t, #"(blank).1" = _t, #"(blank).2" = _t, #"(blank).3" = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"(blank)", type text}, {"(blank).1", type text}, {"(blank).2", type text}, {"(blank).3", type text}}),
#"Promoted Headers" = Table.PromoteHeaders(#"Changed Type", [PromoteAllScalars=true]),
#"Changed Type1" = Table.TransformColumnTypes(#"Promoted Headers",{{"Employee", type text}, {"Monthly Salary", Int64.Type}, {"Start Date", type date}, {"End Date", type date}}),
#"Unpivoted Other Columns" = Table.UnpivotOtherColumns(#"Changed Type1", {"Employee", "Monthly Salary"}, "Attribute", "Value")
in
#"Unpivoted Other Columns"
- Unpivot other columns.
- create a new table manually
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMtQ3MtU3MjC0VNIBsg0hzFidaCUjrBKxAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [Column1 = _t, #"Start Date" = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Column1", type date}, {"Start Date", type date}}),
#"Merged Queries" = Table.NestedJoin(#"Changed Type", {"Start Date"}, Table, {"Value"}, "Table", JoinKind.LeftOuter),
#"Expanded Table" = Table.ExpandTableColumn(#"Merged Queries", "Table", {"Employee"}, {"Table.Employee"})
in
#"Expanded Table"
- Merge queries
Tips: If you have a lot of data, the method will be complicated. I suggest you to calculate Monthly Salary directly without the column of Salary Date.
If you want to calculate the monthly salary with DAX, please post a dummy file that easier to help.
Best Regards,
Xue Ding
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.