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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
vikramsharma184
Frequent Visitor

custom Date range slicer according to slicer

vikramsharma184_0-1657270172533.png

Here One filter is compared with marked in red rectangle and one is a date slicer.
The current session comes from the date slicer and the previous session comes from compared with the slicer.
We are comparing current data with the previous session.  Data like last month, last week, last year. we choose dates in slider and then choose compared with so both data comes and we find out difference and percentages according to it.
Now We want to give flexibility to the user that if data is compared monthly then the date range dates difference will be 30 days no other dates can be selectable. 
Or any other suggestion 
please welcome.

2 REPLIES 2
amitchandak
Super User
Super User

@vikramsharma184 , Last period using same date range diff

same period based on date range
Last Period =
var _max =maxx(allseleceted(date),date[date])
var _min =maxx(allseleceted(date),date[date])
var datediff1 = datediff(_min,_max,day)
var _maxX = _max-datediff1
var _minX = _min -datediff1
return
CALCULATE(SUM(Sales[Sales Amount]),filter(all(date,date[date]<=_maxX &&date[date]>=_minX)))

 

You want to compare two slicers

 

How to use two Date/Period slicers

https://youtu.be/WSeZr_-MiTg

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

We want to give an option of comparison to date slicer
like default which is already given if we select based on monthly then the date range should become min date range to max date range will be only any 30 days after it goes to compared with slicer. All dates except date range in slicer disable. we are fixing the min and max date slicer with a 30days gap in the monthly comparison. 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.