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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
Anonymous
Not applicable

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
Anonymous
Not applicable

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
Anonymous
Not applicable

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?

Anonymous
Not applicable

No the datetable is connected

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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