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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
cbolling
Helper I
Helper I

Create a Rolling Month Filter given a date filter

I have a graph that plots revenue. I need a filter that filters the dates on the graph to show only the current month depending on the selected date. The graph should be a rolling month.

 

If the selected date is March 10, the graph should show March 1-10.

If the selected date is Febraury 28, the graph should show February 1-28.

If the selected date is February 5, the graph should show February 1-5.

 

This is my calculation for the last sale date given the selected date:

TS_LASTSALESDATE2 = CALCULATETABLE ( LASTNONBLANK ( DimDate[DateKey], 0), ALLSELECTED(FactSales))
 
This is my attempt at a filter that didn't work:
Filtered Month = IF(FORMAT(LASTNONBLANK(DimDate[DateKey],0),"YYYYMM")=FORMAT([TS_LASTSALESDATE2],"YYYYMM"),"YES","NO")
 
Appreciate the help!
2 REPLIES 2
amitchandak
Super User
Super User

@cbolling , with help from a  date table use datesmtd

 

example

MTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD('Date'[Date]))

 

Power BI — Month on Month with or Without Time Intelligence
https://medium.com/@amitchandak.1978/power-bi-mtd-questions-time-intelligence-3-5-64b0b4a4090e
https://www.youtube.com/watch?v=6LUBbvcxtKA

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Hi @amitchandak ,

 

I do not want to display MTD sales, I want to display sales of each day in the month, but the X axis is the day of the month, and next week on the first day it would jump back to 1.

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

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