Forum Discussion
Anonymous
6 years agoNot applicable
Distribute pre-payments
I have the following table with payments. These are for pre-payments for a set of terms. InvoiceNo Invoice Date Amount Terms N0001 2-7-2020 6000 6 N0002 5-8-2020 1500 3 N0003...
- 6 years ago
Anonymous - Hmm, this seems similar to what you are trying to do:
https://community.powerbi.com/t5/Quick-Measures-Gallery/Periodic-Revenue-Reverse-YTD/m-p/373185#M111
Also, this might help:
https://community.powerbi.com/t5/Quick-Measures-Gallery/Periodic-Billing/m-p/409365#M148
dax
Community Support
6 years agoHi Anonymous ,
I think you could use M code to achieve this goal.
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("RczLDQAhCATQXjib8FW3im3A0H8bC2zUE8y8ZNaCl4gYGghOFBKKd0SVB7z9LpE6Ptu5l+txzYS2fWq5Hbfa57ufI+D+AQ==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [InvoiceNo = _t, #"Invoice Date" = _t, Amount = _t, Terms = _t]),
#"Changed Type1" = Table.TransformColumnTypes(Source,{{"InvoiceNo", type text}, {"Invoice Date", type date}, {"Amount", Int64.Type}, {"Terms", Int64.Type}}),
#"Added Custom" = Table.AddColumn(#"Changed Type1", "Custom", each {Number.From([Invoice Date])..Number.From(Date.AddDays([Invoice Date],[Terms]-1))}),
#"Expanded Custom" = Table.ExpandListColumn(#"Added Custom", "Custom"),
#"Changed Type" = Table.TransformColumnTypes(#"Expanded Custom",{{"Custom", type date}}),
#"Added Custom1" = Table.AddColumn(#"Changed Type", "Custom.1", each [Amount]/[Terms]),
#"Removed Columns" = Table.RemoveColumns(#"Added Custom1",{"Invoice Date", "Amount"}),
#"Renamed Columns" = Table.RenameColumns(#"Removed Columns",{{"Custom", "date"}, {"Custom.1", "amount"}})
in
#"Renamed Columns"
Best Regards,
Zoe Zhi
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- Anonymous6 years agoNot applicable
Hi Zoe,
Thanks for your reply.
Very clever solution - but solution needs some modification for it to be workable for me as the terms are months, whereas your solution generates the terms based on days.Greetings,
Bas