cancel
Showing results for 
Search instead for 
Did you mean: 

Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.

Reply
Riran
Helper I
Helper I

Ignore lower limit of 'Between' slicer

Hi,

 

I am using the DATEDIFF function to calculate the age in days of the oldest record by comparing earliest Create Date to the current date - like below:

 

Earliest Create Date = MIN('IssuesLog'[Create_Date])

Record Age (Days) = DATEDIFF([Earliest Create Date],TODAY(),DAY)

 

What I want to do is introduce a calendar table to show issues created in a certain period, and show within that period what the age of the oldest record is i.e. keep the upper limit of the date range, but ignore the lower limit.

 

Record Age (Days) in Period = DATEDIFF([Earliest Create Date],MAX(Calendar[Date]),DAY)

 

This works to a degree, but if you put a date Slicer on Calendar Date between for example 1/6/2020 and 30/06/2020 then the oldest is always calculated at 29 days even if there was an issue that was created earlier than 1/6/2020. 

 

Is there a way to make the measure ignore the lower limit, but keep the upper limit?

 

 

1 ACCEPTED SOLUTION
JustJan
Responsive Resident
Responsive Resident

Hi @Riran 
 
You can use the CALCULATE statement to control filters applied to your calculation.
 
IgnoreFromDate = 
var ToDate = Max(Dates[Date])
var EarliestCreateDate = CALCULATE(MIN('Table'[Date]), ALL('Table') ,'Table'[Date] <= ToDate)
return DateDiff(EarliestCreateDate,Todate,DAY)

Jan

View solution in original post

1 REPLY 1
JustJan
Responsive Resident
Responsive Resident

Hi @Riran 
 
You can use the CALCULATE statement to control filters applied to your calculation.
 
IgnoreFromDate = 
var ToDate = Max(Dates[Date])
var EarliestCreateDate = CALCULATE(MIN('Table'[Date]), ALL('Table') ,'Table'[Date] <= ToDate)
return DateDiff(EarliestCreateDate,Todate,DAY)

Jan

Helpful resources

Announcements
PBI November 2023 Update Carousel

Power BI Monthly Update - November 2023

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

Community News

Fabric Community News unified experience

Read the latest Fabric Community announcements, including updates on Power BI, Synapse, Data Factory and Data Activator.

Power BI Fabric Summit Carousel

The largest Power BI and Fabric virtual conference

130+ sessions, 130+ speakers, Product managers, MVPs, and experts. All about Power BI and Fabric. Attend online or watch the recordings.

Top Solution Authors
Top Kudoed Authors