Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
AmitSaini
Helper I
Helper I

How to get previous month values based on Month year column values

Hi Community member,

Need help to get some desired result.

Below is the my dataset.

AmitSaini_6-1733133719631.png

 

and I already create a measure to calcualte the values for previous months for column automated. below is the measure:

AmitSaini_2-1733133321519.png

and my table look like below and that is absoluty fine:

AmitSaini_7-1733133838475.png

 

But i want to show previous month data  based on MonthName column [column name shown on first screenshot]  and when i use monthname column on table then previous month data is showing 0. see below pic.

AmitSaini_8-1733133963433.png

Please suggest. how can i use monthname column to calculate previous months data based on projectname?

 

 

1 ACCEPTED SOLUTION
johnt75
Super User
Super User

Create a date table and mark it as a date table. There's lots of articles and videos on how to do that. Link your date table to the date column in your fact table, and then use columns from your date table in the visuals. Your measure using PREVIOUSMONTH will then work if you change the date column to the date column from the date table.

View solution in original post

4 REPLIES 4
FreemanZ
Super User
Super User

hi @AmitSaini ,

 

try like:

...

VAR pvevious= 

CALCULATE(

SUM(Status[Automated],

EOMONTH(Status[datevalue], 0) = EOMONTH(MAX(Status[datevalue]), -1)

)

...

Hi FreemanZ,

 

Thanks for you reply.

I tried your suggestion but it won't works when we use monthname column.

johnt75
Super User
Super User

Create a date table and mark it as a date table. There's lots of articles and videos on how to do that. Link your date table to the date column in your fact table, and then use columns from your date table in the visuals. Your measure using PREVIOUSMONTH will then work if you change the date column to the date column from the date table.

Hi  johnt75,

 

Thanks for the suggestion and it works very well. Really appreciate it.

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.