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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
PBI5851
Helper V
Helper V

Custom Formula to mark Data range

I have a request to display the rolling last 15, 30, 45, 90, 120 and higher on multiple visuals within a single page. So, one visual should display the last 15 days, another visual to display the last 45 days etc.. So , my idea is to create a custom column within the Date which will mark all those days within the 15 days as 15 and with 30 days as 30 etc. 

 

Any recommendation on how to achieve that. I do have a date table and can create a custom column if needed , but not sure if creating a custom column would be the approach or a measure . Please advise on the solution to achieve this. 

2 REPLIES 2
amitchandak
Super User
Super User

@PBI5851 , beast is relative date slicer.

If nor you need create a slicer using a table (enter date)  and you will also need an independent date table to display of trend(as rolling will sum up data into one date)

 

example

Rolling 30 day = CALCULATE(sum(Sales[Sales Amount]),DATESINPERIOD('Date'[Date],MAX(Sales[Sales Date]),-30,Day))

 

Refer a similar solution in the past:https://community.powerbi.com/t5/Desktop/Required-custom-date-Slicer-Last-7-days-last-15-days-last-3...

 

This video how to display trend when data rollup into one date https://www.youtube.com/watch?v=duMSovyosXE

 

Measure slicer  additional reference: https://radacad.com/change-the-column-or-measure-value-in-a-power-bi-visual-by-selection-of-the-slic...

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
lbendlin
Super User
Super User

that's a reasonable approach. 

 

Create calculated columns like so

 

InLast15 = TODAY()-dates[Date]<=15

InLast30 = TODAY()-dates[Date]<=30

 

and so on. Then use these columns in your measure filters.

 

Note that this pretty much assumes that your dataset is refreshed daily.

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 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.