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
Manikantans2
Frequent Visitor

Default Month Filter along with MoM

Greetings, 

 

I have a 'Period' column and a 'Revenue' column in my table. I have set up a calendar table as well. 

I am displaying previous month revenue (Previous of the month selected in the month slicer) as a card using the below DAX:

 
Last Month Revenue = CALCULATE([Actual Revenue], DATEADD('Calendar'[Date].[Date], -1, MONTH))

This is working fine.

 

Now i have a requirement to show the data of the last month as the default when the report is opened. In Power Query, i created a column called 'Last Month' that will have a value 'Last Month' for the last month, else null.

Expression = if Date.IsInPreviousMonth([Period]) then "Last Month" else "")

I use this column as a filter now. 

 

When i select June - 2022 from the slicer, the last month revenue displays the May - 2022's revenue correctly. But when i select the 'Last Month' slicer, the last month value is  same as that of the June month value. 

 

What am i missing? Please assist. 

 

Yours Truly,

Manikantan S

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Manikantans2 , Create a column like this and try

 

Month Type = Switch( True(),
eomonth([Date],0) = eomonth(Today(),-1),"Last Month" , //Last Month
eomonth([Date],0)= eomonth(Today(),0),"This Month" , //This Month
[Month Year]
)

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

View solution in original post

3 REPLIES 3
Manikantans2
Frequent Visitor

Hi Amit, 

 

The solution you provided is working. I guess i had to "Mark as Date Table" for the calendar table in addition. Thanks for the solution. 

amitchandak
Super User
Super User

@Manikantans2 , Create a column like this and try

 

Month Type = Switch( True(),
eomonth([Date],0) = eomonth(Today(),-1),"Last Month" , //Last Month
eomonth([Date],0)= eomonth(Today(),0),"This Month" , //This Month
[Month Year]
)

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

Thanks Amit. The issue remains the same still.

 

Slight change to what you mentioned. 

Created a column as :

Month Type = SWITCH(TRUE(),
ENDOFMONTH('Calendar'[Date].[Date]) = EOMONTH(TODAY(),-1), "Last Month",
"")
 
Now i use this Month Type as a filter. On selection last month, the last month revenue (i.e. for May ) shows the same as June. 

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!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

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.