Forum Discussion
Power Query: Custom column to sum revenues for remaining months based on selected month number
- 8 months ago
Hello Abourard,
Try this M code in Power Query. It filters months greater than your selected month and sums their revenues. You can either use a parameter for one forecast point or calculate it row‑by‑row:
1. Using a parameter (single forecast point)
let Source = YourTable, SelectedMonth = 5, // or create a parameter RemainingMonths = Table.SelectRows(Source, each [MonthNumber] > SelectedMonth), SumRemainingRevenue = List.Sum(RemainingMonths[Revenue]), Result = Table.AddColumn(Source, "RemainingRevenue", each SumRemainingRevenue) in Result2. Row‑level calculation (each month forecasts the rest of the year)
Result = Table.AddColumn(Source, "RemainingRevenue", each List.Sum( Table.SelectRows(Source, (r) => r[MonthNumber] > [MonthNumber])[Revenue] ) )Use the parameter approach if you want one forecast based on a chosen month, or the row‑level approach if you want every month to show its own “remaining months” total.
Hi Abourard,
Thank you for reaching out to the Microsoft Fabric Community Forum. Also, thanks to Olufemi7, Royel, cengizhanarslan, GeraldGEmerick, for those inputs on this thread.
Has your issue been resolved? If the response provided by the community member Olufemi7, Royel, cengizhanarslan, GeraldGEmerick, addressed your query, could you please confirm? It helps us ensure that the solutions provided are effective and beneficial for everyone.
Hope this helps clarify things and let me know what you find after giving these steps a try happy to help you investigate this further.
Thank you for using the Microsoft Community Forum.
- v-kpoloju-msft8 months ago
Community Support
Hi Abourard,
Just wanted to follow up. If the shared guidance worked for you, that’s wonderful hopefully it also helps others looking for similar answers. If there’s anything else you'd like to explore or clarify, don’t hesitate to reach out.Thank you.