Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.
Hello,
I'm new in power bi and I'm trying to create a new column that allows me to get the value of the previous month, but I have several columns in the data and I don´t know how to perform the filter. I have tried with previousmonth function, but I do not get the desired value.
Thanks for your help.
Solved! Go to Solution.
You can use the following code to generate a new column:
Column = VAR __CurrentPeriod = Test[PERIOD D/M/YY] var __CurrentCountry = Test[COUNTRY] var __CurrentProduct = Test[PRODUCT] var __CurrentActivity = Test[ACTIVITY] RETURN CALCULATE( SUM( Test[CANTIDAD] ), FILTER( Test, Test[COUNTRY] = __CurrentCountry && Test[PRODUCT] = __CurrentProduct && Test[ACTIVITY] = __CurrentActivity && __CurrentPeriod = NEXTMONTH(Test[PERIOD D/M/YY]) ) )
Hello I was trying to use the attached thread to solve a similar issue - i cannot get the previous month column to return the previous periods hours (week ending - are weekly periods - link to the week column). see screen shot below which has the formula + the table view.
Therefore for a given employee and a given time stamp and a given week - i would like to return the previous month value so that i can then see on a graph later the difference - or the monthly value - note my data is cumulative data.
The screen shot below shows the current formula i have -
Any help would be greatly appreciated.
You can use the following code to generate a new column:
Column = VAR __CurrentPeriod = Test[PERIOD D/M/YY] var __CurrentCountry = Test[COUNTRY] var __CurrentProduct = Test[PRODUCT] var __CurrentActivity = Test[ACTIVITY] RETURN CALCULATE( SUM( Test[CANTIDAD] ), FILTER( Test, Test[COUNTRY] = __CurrentCountry && Test[PRODUCT] = __CurrentProduct && Test[ACTIVITY] = __CurrentActivity && __CurrentPeriod = NEXTMONTH(Test[PERIOD D/M/YY]) ) )
Amazing. Works perfectly. Thanks for your great solution.