This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. We're covering it all. You won't want to miss it.
Learn moreLevel up your Power BI skills this month - build one visual each week and tell better stories with data! Get started
I have a table called Production.
In this table, I have columns with the months of the year and ending with a column called Year Total.
I need to pull the data from the previous month column for a formula for a rate.
My formula worked for the Year Total but not been able to figure out how to get the data from the previous month column.
Thanks
Todd
Solved! Go to Solution.
Hi @tockert
Add MonthNo column for your table.Then you may get the PreviousMonth's production with below measure.
Measure =
CALCULATE (
SUM ( 'Table'[Production] ),
FILTER ( ALL ( 'Table' ), 'Table'[MonthNo] = MAX ( 'Table'[MonthNo] ) - 1 )
)
Regards,
Hi Todd,
Can you unpivot the data?
If so, you can use the unpivoted month column as a date the date field where you can use the following function in dax to sum previous month
https://docs.microsoft.com/en-us/dax/previousmonth-function-dax
This is what the data looks like from the source record.
Year, Jan, Feb, Mar and so on until the last column is Year Total.
The year is the current year, and then production numbers are listed for each month.
I have the ability to take this data prior to pulling it into Power BI to change the months and production numbers into 2 columns.
Not sure what you meant by "unpivot the data."
If I do this with the data prior to the import, I think this will work.
| Month | Production |
| JAN | 5653758 |
| FEB | 5106620 |
| MAR | 5653758 |
| APR | 0 |
| MAY | 0 |
| JUN | 0 |
| JUL | 0 |
| AUG | 0 |
| SEP | 0 |
| OCT | 0 |
| NOV | 0 |
| DEC | 0 |
Thanks
Todd
Hi @tockert
Add MonthNo column for your table.Then you may get the PreviousMonth's production with below measure.
Measure =
CALCULATE (
SUM ( 'Table'[Production] ),
FILTER ( ALL ( 'Table' ), 'Table'[MonthNo] = MAX ( 'Table'[MonthNo] ) - 1 )
)
Regards,
Check out the April 2026 Power BI update to learn about new features.
Sign up to receive a private message when registration opens and key events begin.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
| User | Count |
|---|---|
| 39 | |
| 28 | |
| 27 | |
| 22 | |
| 18 |
| User | Count |
|---|---|
| 67 | |
| 37 | |
| 32 | |
| 26 | |
| 25 |