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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
AmitSaini
Frequent Visitor

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
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.