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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Filter relative to measure not computer date

I am trying to create a report that will just display the records of the last twelve months.  There is an option that allows a relative filter on a field.   The filter will allow you to show "the last 12 months" of records based on my transaction date.  So if I look at the report on the 15th of the month, "the last 12 months is in accurate". An example:

 When your computer date is in August 15, 2019, it will pick up records from August 15, 2018 to August 15, 2019.  We need to look at this from August 1, 2018 to August 31, 2019.  I was hoping that we could do the filter relative to a measure instead of the computer time.  We could then say, filter transaction date based on it being >= measure 1 and <= measure 2.   Where measure 1= August 1, 2018 and measure 2 is August 31, 2019.  Does anyone have a solution to this?

2 REPLIES 2
amitchandak
Super User
Super User

Refer Dates. date dim is marked as date in power bi

Change Date End = 
Var _endDate= Maxx(ALLSELECTED('Date'[Date Filer]),ENDOFMONTH('Date'[Date Filer]))
Var   _start_date= minx(ALLSELECTED('Date'[Date Filer]),DATEADD(STARTOFMONTH('Date'[Date Filer]),-12,MONTH))


return
_endDate & " " & _start_date

Sales

Change Date End Sales = 
Var _endDate= Maxx(ALLSELECTED('Date'[Date Filer]),ENDOFMONTH('Date'[Date Filer]))
Var   _start_date= minx(ALLSELECTED('Date'[Date Filer]),DATEADD(STARTOFMONTH('Date'[Date Filer]),-12,MONTH))


return
calculate(sum(Sales[Sales Amount]),Sales[Sales Date] >= _start_date && Sales[Sales Date] <= _endDate)
Ashish_Mathur
Super User
Super User

Hi,

See if my solution here helps - Flex a Pivot Table to show data for x months ended a certain user defined month.

Hope this helps.


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

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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