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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
Anonymous
Not applicable

Show value from the last 30-90 days from this current date?

Hi there, 

I was just wondering if there is a way I can create a measure that will show a total value for the last 30-90 days? 

So currently I have a table with two columns, an ID column and an date column. I have created a count measure that counts the ID's and it's called [Total Users] then I have a date column that's called [active_date].

How would I be able to get the [Total Users] from the last 30-90 days. I've tried the relative date filter tool but you can't set between conditions that's relative to todays date, so I'm hoping this can be done in a measure? 

1 ACCEPTED SOLUTION
Whitewater100
Solution Sage
Solution Sage

Hi:

Can you add date table and connect to our fact table on Date field? I'll paste new Date Table code below.. It should also be marked as a Date Table. Using the Dates[Date] field in your visuals:

Total Retail last 90 to 30 Days =
var lstdate = LASTDATE('SalesOrders'[Order_Date])
var lstdateless90 = lstdate -90
var lstdateless30 = lstdate -30
return
CALCULATE([Total Users], DATESBETWEEN(Dates[Date], lstdateless90, lstdateless30))
 
Date Table. MODELING> New Table

Dates = ADDCOLUMNS ( CALENDAR (FIRSTDATE(Sheet1[ Date]), TODAY()), "year", YEAR ( [Date] ), "MonthNumber", FORMAT ( [Date], "MM" ), "year-month", FORMAT ( [Date], "YYYY-MM" ), "month-year", FORMAT ( [Date], "MM-'YY" ) )

I would format the Dates[Date Field] to a Date like 

Whitewater100_0-1654737367140.png

I hope this helps..

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

Hello @Whitewater100 , can you please help?

I have created, below filter,

 

chinmayshah16_0-1673483250971.png

In the marks card I want to display today's date minus what ever the option I pick from the slicer,

So if today is 11 January, 2023 and user pick 'last 6 months' from the slicer then I would like to display, 

(11 July, 2022 - 11 January, 2023)

It should keep on changing based on what user pick from the slicer.

How can I do that? Please help!

 

 

 

Whitewater100
Solution Sage
Solution Sage

Hi:

Can you add date table and connect to our fact table on Date field? I'll paste new Date Table code below.. It should also be marked as a Date Table. Using the Dates[Date] field in your visuals:

Total Retail last 90 to 30 Days =
var lstdate = LASTDATE('SalesOrders'[Order_Date])
var lstdateless90 = lstdate -90
var lstdateless30 = lstdate -30
return
CALCULATE([Total Users], DATESBETWEEN(Dates[Date], lstdateless90, lstdateless30))
 
Date Table. MODELING> New Table

Dates = ADDCOLUMNS ( CALENDAR (FIRSTDATE(Sheet1[ Date]), TODAY()), "year", YEAR ( [Date] ), "MonthNumber", FORMAT ( [Date], "MM" ), "year-month", FORMAT ( [Date], "YYYY-MM" ), "month-year", FORMAT ( [Date], "MM-'YY" ) )

I would format the Dates[Date Field] to a Date like 

Whitewater100_0-1654737367140.png

I hope this helps..

Anonymous
Not applicable

Thank you @Whitewater100 

That worked brilliantly! 

Great! Your welcome..

Helpful resources

Announcements
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 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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