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
tsynenkyy
Helper II
Helper II

Filters Compare two years, first one selected, the second one automated

Hi guys,

 

I have the following two filters:

tsynenkyy_0-1665038496906.png

You select both years and the measures works perfectly, but the next step is to automatize the "Year & Month Comparison" so when I select "Year & Month" = 2022   then automatically the filter "Year & Month Comparison" will select 2021.

 

Relationship between both time tables:

tsynenkyy_2-1665038626297.png

thanks

2 REPLIES 2
amitchandak
Super User
Super User

@tsynenkyy , with help from a date table last year can be

 

Year behind Sales = CALCULATE(SUM(Sales[Sales Amount]),dateadd('Date'[Date],-1,Year))
Year behind Sales = CALCULATE(SUM(Sales[Sales Amount]),SAMEPERIODLASTYEAR('Date'[Date]))

 

//Only year vs Year, not a level below

This Year = CALCULATE(sum('Table'[Qty]),filter(ALL('Date'),'Date'[Year]=max('Date'[Year])))
Last Year = CALCULATE(sum('Table'[Qty]),filter(ALL('Date'),'Date'[Year]=max('Date'[Year])-1))
diff = [This Year]-[Last Year ]
diff % = divide([This Year]-[Last Year ],[Last Year ])

 

 

Power BI — Year on Year with or Without Time Intelligence
https://medium.com/@amitchandak.1978/power-bi-ytd-questions-time-intelligence-1-5-e3174b39f38a
https://www.youtube.com/watch?v=km41KfM_0uA

Hi, many thanks for your asnwer but I think this is not what I need, actually I think that what I need is not possible in Power BI.

 

I need to keep the functionality I have (select both years) but when I firstly select the "Year and Month" it must automatically change the value on my other filter "year and month comparison) to YearSelected - 1, but I think is not possible that.

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.