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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Sandvik19
New Member

Custom End Date

Select a end date from a filter and use it to calculate last 90 days and last 120 days. The Custom End date should not apply to any visual on the report. it should only be used for calculation (last 90 and 120 days)

I am currently doing this 

 VAR OneYearAgo =  CALCULATE(
    COUNTROWS('DateTable'),
 FILTER('DateTable',
 'DateTable'[Month Year]>=MaxDate-90 && 'DateTable'[Month Year]<=MaxDate)
but it is only returning the selected end date and not the range, please help!
1 ACCEPTED SOLUTION
Sandvik19
New Member

Thanks a lot for your responses! I used a disconnected date table to get the end date now this code works perfectly!

VAR MaxDate =  SELECTEDVALUE('DisconnectedTable'[Month Year])



 VAR OneYearAgo =  CALCULATE(
    COUNTROWS('DateTable'),
 FILTER('DateTable',
 'DateTable'[Month Year]<=MaxDate && 'DateTable'[Month Year]>=MaxDate-90)

View solution in original post

4 REPLIES 4
Sandvik19
New Member

Thanks a lot for your responses! I used a disconnected date table to get the end date now this code works perfectly!

VAR MaxDate =  SELECTEDVALUE('DisconnectedTable'[Month Year])



 VAR OneYearAgo =  CALCULATE(
    COUNTROWS('DateTable'),
 FILTER('DateTable',
 'DateTable'[Month Year]<=MaxDate && 'DateTable'[Month Year]>=MaxDate-90)
Ashish_Mathur
Super User
Super User

Hi,

This pattern should work.  I have assumed that you have already written a measure named MaxDate.

VAR OneYearAgo =  CALCULATE(COUNTROWS('DateTable'),DATESBETWEEN(Calendar[date],[MaxDate]-90,[MaxDate]))

 


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
lbendlin
Super User
Super User

Is that 'DateTable' disconnected from your data model?

No the datetable is connected

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.