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.

avatar user

Helpful resources

Announcements
March PBI video - carousel

Power BI Monthly Update - March 2025

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

March2025 Carousel

Fabric Community Update - March 2025

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

Top Solution Authors (Last Month)
Top Kudoed Authors (Last Month)