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
ogend
Helper I
Helper I

Dynamic Current and Prior Year assignment based on slicer Current Year selection

Hi Power BI Gurus, 

 

This is how a  simplified version  of my table looks like  - it has multiple years of data in the same format, one line per department for a given Period/ Scenario combination. 

Is there a way to dynamically select Current year from a slicer so that if I select a year - it will be treated as Current Year (CY) and CY-1 will become Prior Year (PY)

 

PeriodScenarioDepartment Revenue
Dec-17Actualdepartment1500
Mar-18Forecastdepartment1550
Jun-18Forecastdepartment1600
Sep-18Forecastdepartment1500
Dec-18Forecastdepartment1530
Dec-18Actualdepartment1535
Mar-19Forecastdepartment1580
Jun-19Forecastdepartment1600
Sep-19Forecastdepartment1620
Dec-19Forecastdepartment1590
Dec-19Actualdepartment1600
Mar-20Forecastdepartment1620
Jun-20Forecastdepartment1630
Sep-20Forecastdepartment1620
Dec-20Forecastdepartment1610
Dec-20Actualdepartment1600
Dec-17Actualdepartment2575
Mar-18Forecastdepartment2633
Jun-18Forecastdepartment2690
Sep-18Forecastdepartment2575
Dec-18Forecastdepartment2610
Dec-18Actualdepartment2615
Mar-19Forecastdepartment2667
Jun-19Forecastdepartment2690
Sep-19Forecastdepartment2713
Dec-19Forecastdepartment2679
Dec-19Actualdepartment2690
Mar-20Forecastdepartment2713
Jun-20Forecastdepartment2725
Sep-20Forecastdepartment2713
Dec-20Forecastdepartment2702
Dec-20Actualdepartment2700
Dec-19Actualdepartment 3345
Mar-20Forecastdepartment 3357
Jun-20Forecastdepartment 3362
Sep-20Forecastdepartment 3357
Dec-20Forecastdepartment 3351
Dec-20Actualdepartment 3350

 

my final goal would be: I select Current Year = 2020

 

 2019    2020
 PYForecast03Forecast06Forecast09Forecast12CY
department1600620630620610600
department2690713725713702700
department 3345356.5362.25356.5350.75350

 

If I select Current Year = 2019

 2018    2019
 PYForecast03Forecast06Forecast09Forecast12CY
department1535580600620590600
department2615667690713679690
department 3     345

 

There might be department 3 scenario when new departments have no prior year activity. 

 

Thank you! 

 

Olga

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@ogend , Create a date table, Have year there, and use that in the slicer. Use time intelligence for this year vs last year

 

In case you have a month in a given format, not date. Create date: a new column

Date = "01-" & [Period] // change data type to date and use

 

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

View solution in original post

2 REPLIES 2
ogend
Helper I
Helper I

Thanks a lot for the guidance, @amitchandak 

 

I was able to build what i need based on the article you shared

 

Olga

amitchandak
Super User
Super User

@ogend , Create a date table, Have year there, and use that in the slicer. Use time intelligence for this year vs last year

 

In case you have a month in a given format, not date. Create date: a new column

Date = "01-" & [Period] // change data type to date and use

 

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

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.