Forum Discussion
Last Month
- 2 years ago
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 LabelHope 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!!
Hi JamesBurke - create a calculated column as below and se the month label as slicer in your chart.
Hope it helps
Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!!
- JamesBurke2 years agoHelper III
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
Just Not sure How to Format it correctly.
Thanks James.
- rajendraongole12 years agoSuper User
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 LabelHope 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!!- JamesBurke2 years agoHelper III