Forum Discussion
Anonymous
4 years agoNot applicable
Dynamic column names needed in a dynamic sum equation
Hi guys, I need to pivot a column full of payslip IDs with values that is their pay amount for the fortnight. The payslip IDs are incremental so I am able to extract only the latest 6 payslips an...
- Anonymous4 years ago
Hi Anonymous
Not sure if you really need to unpivot those columns, keep them then sum up, but yes, there are ways to do in M. I created dummy data to show 2 ways in the file. You need to amend the logic accordingly for finding the latest 6 columns, and remove values not in these columns - last6 list and the list.sum
AlexisOlson
Super User
4 years agoI'd strongly recommend against trying to do it this way. Life will be much easier keeping things unpivoted and doing any summing with DAX measures rather than Power Query custom columns.