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

We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now

Reply
JamesBurke
Helper III
Helper III

Last Month

Hi All , 

 

Month 2 = IF( 'Date'[Mth & Yr]  = DATE(YEAR(TODAY()),MONTH(TODAY())-1,1), "Last Month", FORMAT('Date'[Mth & Yr] , "MM-DD-YYYY") ) 

 

Screenshot 2024-07-19 115607.png

 

I have the above Measure , i'm trying to only Use Last Month  but this is dynamic so as the month increases i would like the latest month to be filtered like Month -1

 

So it should say 

 

04 

 

05 then Last Month 

 

Thanks , James . 

1 ACCEPTED SOLUTION

Hi @JamesBurke - if you want to show last month and current month with right format, create a calculate column as below 

MonthLabel2 =
VAR CurrentMonth = MONTH(TODAY())
VAR CurrentYear = YEAR(TODAY())
VAR LastMonth = IF(CurrentMonth = 1, 12, CurrentMonth - 1)
VAR LastMonthYear = IF(CurrentMonth = 1, CurrentYear - 1, CurrentYear)
VAR DateMonth = MONTH('Date'[Date])
VAR DateYear = YEAR('Date'[Date])
VAR Label =
    IF(DateMonth = LastMonth && DateYear = LastMonthYear, "Last Month",
    IF(DateMonth = CurrentMonth && DateYear = CurrentYear, "Current Month",
    FORMAT('Date'[Date], "MM-DD-YYYY")))

RETURN Label

rajendraongole1_0-1721394229575.png

 

 

Hope it resolve the issue. 

Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!!





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





View solution in original post

4 REPLIES 4
rajendraongole1
Super User
Super User

Hi @JamesBurke - create a calculated column as below and se the month label as slicer in your chart. 

 

rajendraongole1_0-1721388625616.pngrajendraongole1_1-1721388642902.png

 

Hope it helps

 

Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!!





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





HI @rajendraongole1 ,

Thanks for this , This did help , I'm thinking to solve my problem i need a current Month and Prvious Month which i can filter to is not "Current Month"

Month Label 2 = 
VAR CurrentMonth = MONTH(TODAY())
VAR CurrentYear =  Year(TODAY())
VAR LastMonth = IF(CurrentMonth = 1 , 12,CurrentMonth-1)
VAR LastMonthYear = IF(CurrentMonth =1 , CurrentYear -1,CurrentYear)
VAR DateMonth = MONTH('Date'[Date])
VAR DateYear = YEAR('Date'[Date])
RETURN
'Date'[Mth & Yr] & 

IF(DateMonth = LastMonth && DateYear = LastMonthYear,
"Last Month")

&

IF(DateMonth = CurrentMonth && DateYear = LastMonthYear,
"Current Month")



Using Above but it returns 

 

JamesBurke_0-1721392113026.png

 

Just Not sure How to Format it correctly.

 

Thanks James. 

Hi @JamesBurke - if you want to show last month and current month with right format, create a calculate column as below 

MonthLabel2 =
VAR CurrentMonth = MONTH(TODAY())
VAR CurrentYear = YEAR(TODAY())
VAR LastMonth = IF(CurrentMonth = 1, 12, CurrentMonth - 1)
VAR LastMonthYear = IF(CurrentMonth = 1, CurrentYear - 1, CurrentYear)
VAR DateMonth = MONTH('Date'[Date])
VAR DateYear = YEAR('Date'[Date])
VAR Label =
    IF(DateMonth = LastMonth && DateYear = LastMonthYear, "Last Month",
    IF(DateMonth = CurrentMonth && DateYear = CurrentYear, "Current Month",
    FORMAT('Date'[Date], "MM-DD-YYYY")))

RETURN Label

rajendraongole1_0-1721394229575.png

 

 

Hope it resolve the issue. 

Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!!





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





@rajendraongole1 

 

You are a Wizard , Thank you !!

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

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