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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Jidnyasa2904
Helper I
Helper I

Dynamic period shift for TY & LY Comparison

My matrix has event data, the days between events TY and LY vary. So, I have created this date shift column from which if I select 8, the values from LY will shift 8 days and match the TY time. 
I want to make this dynamic. 
Jidnyasa2904_0-1723649384751.png

Any leads are welcome. Thanks in advance!

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi  @Jidnyasa2904 ,

I created some data:

vyangliumsft_0-1723689643754.png

 

Here are the steps you can follow:

1. Create measure.

Measure =
var _select=SELECTEDVALUE('Data Shift Table'[Data Shift])
return
SUMX(
    FILTER(ALL('Test_Table'),
    'Test_Table'[Date  TY]=MAX('Test_Table'[Date  TY])-_select),[LY])

2. Result:

vyangliumsft_1-1723689643758.png

 

If the results above don't meet your expectations, Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data. We can better understand the problem and help you.

 

Best Regards,

Liu Yang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi  @Jidnyasa2904 ,

I created some data:

vyangliumsft_0-1723689643754.png

 

Here are the steps you can follow:

1. Create measure.

Measure =
var _select=SELECTEDVALUE('Data Shift Table'[Data Shift])
return
SUMX(
    FILTER(ALL('Test_Table'),
    'Test_Table'[Date  TY]=MAX('Test_Table'[Date  TY])-_select),[LY])

2. Result:

vyangliumsft_1-1723689643758.png

 

If the results above don't meet your expectations, Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data. We can better understand the problem and help you.

 

Best Regards,

Liu Yang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

@Anonymous Hi Yangliu, 

Thank you for helping with the date shift. But I am facing a problem when I Drill up the date column. 
I drill up to check how I performed weekly. And it gives an average value instead of SUM for that particular week. 
The orange color column is not drilled up correctly. (Thats the same measure as above solution)
1. Drilled

Jidnyasa2904_2-1724166630738.png

 

2. Drill Up

Jidnyasa2904_3-1724166647792.png

 

 

 

 



Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.