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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
rohanghule12
Frequent Visitor

Dax for Rolling 5 weeks from selected week and for last 2 Years

Hello All,

 

I have a sales data which contains fiscal week, Fiscal week Relative, fiscal year, total sales...

I have one scliers which contains Fiscal week Relative. Data is for fiscal year (Feb to Feb).

Suppose I have selected -10 as my relative week from sclier. Now I want to see total sales for last rolling 5 weeks.

And I want to show this is in line chart for last 2 Years (2023 and 2022 in legend).

Need to see week 13,12, 11,10 and 9 in x-axis and sales on Y axis.

Attached image of data and output as example.

IMG_20230711_182411.jpg

IMG_20230711_182252.jpg

1 ACCEPTED SOLUTION
Anonymous
Not applicable

HI @rohanghule12,

If you want the slicer to achieve custom selector effect instead of filter. I'd like to suggest you create an unconnected table as source of slicer. Then you can extract the selection from the slicer and use it as condition in your formulas.

Logic:
Extract the selected value to get the field value less than or equal to selected value -4 to get correspond week number list, then use these number to define the calculation range. 
Use selected value to find out current date and extract the year part to use in if statement to check the filter ranges.(current and previous year)

Regards,

Xiaoxin Sheng

View solution in original post

1 REPLY 1
Anonymous
Not applicable

HI @rohanghule12,

If you want the slicer to achieve custom selector effect instead of filter. I'd like to suggest you create an unconnected table as source of slicer. Then you can extract the selection from the slicer and use it as condition in your formulas.

Logic:
Extract the selected value to get the field value less than or equal to selected value -4 to get correspond week number list, then use these number to define the calculation range. 
Use selected value to find out current date and extract the year part to use in if statement to check the filter ranges.(current and previous year)

Regards,

Xiaoxin Sheng

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

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.