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

Relative (Dynamic) Date Filter - Compare last x months but for 2 years

Hi,

 

I am quite new to this community, and I am still learning - in advance, sorry if this is posted in the wrong place. We have a full BI team setting up our data and connections, and as such I do not have access to tables and data models. I am trying to ensure this line chart always only show the last 3 months of this year - BUT also the same 3 months from last year:

 

last - and same 3 months over 2 years.PNG

 

(1) Info on my visual: I have a line chart (see above), that shows the last 3 months (adoption rate for an app of mine) - for 2 different years (2018 and 2019). For this, I have 2 filters on the visual:

 

  • Filter 1: Year is = 2018 or 2019
  • Filter 2: Month is = September, October, November

 

(2) My issue - manually updating months: When we reach december, I have to manually deselect september in my filter for months - and instead select december, so that the visual shows me the last 3 months for 2019 (and the same months for 2018). I would like to avoid this manual work at the beginning of each month.

 

(3) The question about dynamic date filter over different years

 

Is there any way to have a sort of dynamic relative date filtering? I am thinking a filter that would go something along the lines of;

 

  • Filter: Show data from last 3 months this year AND also the same 3 months from last year

Again, I do not have access to the actual data tables and modelling - so is it even possible for me to create a filter such as this, or a measure that includes this data and updates each time the month changes? In advance, thanks for your help (I am trying to learn, be

2 REPLIES 2

Hi,

 

You can use

SAMEPERIODLASTYEAR and PARALLELPERIOD

These are time intelligent functions that you can use to build your measures on. PowerBI Dax documentation will further explain how to use these.

Anonymous
Not applicable

@VipulToshniwal  - Thanks for the guidance. I've checked out both functions, and I've managed it - in parts. My main issue is that my line chart can only hold 1 measure within "Values". As such - I have not been able to create a measure that would show me fx.:

Measure (example): Show Last 2 months including this month - but for 2 different years.

 

To give a more precise insight - the graph below (line chart) shows me data from the value "Adoption Rate" (<-- which is a measure I've made using a simple division of 2 data-points) for the years 2018 and 2019, and the months of September, October, November. This is naturally because I've selected these exact months and the exact years in the filters (as seen on the screenshot).

 

filters.PNG

 

 

 

 

 

 

 

 

However, once we reach december, I have to open this report - and change the "Month" to "October, November, December" - and this is the process I'm trying to automate (so just always showing the last 3 months from this year - as well as the same months from last year). Not sure how to do this by making new measure for SAMEPERIODLASTYEAR as the "Value" field in a line chart can only hold 1 measure. I suppose I would have to have a measure to show "LAST 3 MONTHS OF THIS YEAR + SAME 3 MONTHS OF LAST YEAR", but I have not been able to figure that out yet.

 

EDIT: If I could make the above mentioned measure and then just set the date filter to relative and "LAST 3 MONTHS" that would be amazing (but everytime I select last 3 months, everything from 2018 of course disappears).

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.