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

Next up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now

Reply
pola
New Member

How to build dynamic X-axis showing four weeks back depends on week selected in slicer?

I want to build the line chart showing 4 data point after 4 consecutive weeks. My users select a given week in the slicer and the line chart displays 4 weeks back in cluding selected week. I specificly struggle to build the measure which accepts dynamic max and mix constraints... Any idea? 

2 ACCEPTED SOLUTIONS
qqqqqwwwweeerrr
Super User
Super User

Hi @pola 

 

This video might help you take an approach this is not exact solution for sure but with some modification it should work: 
1. https://youtu.be/uQPXYW79m3A?si=FaJo5MkYOtt0Q0X4 

2. https://youtu.be/GTHVXaKseZw?si=PYSJYlO4iVwGrz-G

Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
Check for more intersing solution here: www.youtube.com/@Howtosolveprobem

Regards

View solution in original post

pola
New Member

Hi, just in case, this vidoe helped us out to find a solution. Very cool. Show last 6 months based on user single slicer selection (youtube.com)

View solution in original post

4 REPLIES 4
pola
New Member

Hi, just in case, this vidoe helped us out to find a solution. Very cool. Show last 6 months based on user single slicer selection (youtube.com)

qqqqqwwwweeerrr
Super User
Super User

Hi @pola 

 

This video might help you take an approach this is not exact solution for sure but with some modification it should work: 
1. https://youtu.be/uQPXYW79m3A?si=FaJo5MkYOtt0Q0X4 

2. https://youtu.be/GTHVXaKseZw?si=PYSJYlO4iVwGrz-G

Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
Check for more intersing solution here: www.youtube.com/@Howtosolveprobem

Regards

RPYee
Frequent Visitor

I did something similar, wanting to display the previous 13 weeks data. I may not have done it the easiest way possible, but it does work for me. Hopefully it will help you!

 

First of all, I created a new column to calculate the report date which is based on the date of the previous Saturday. Our weeks are viewed Sunday thru Saturday.

 

WKLY_RPT_ENDDATE = TODAY()-WEEKDAY(TODAY())

 

I then assigned a number for each of the previous weeks, calling this "WEEKSAGO"

WEEKSAGO = FLOOR((-(DATEDIFF(SOURCE_TABLE[WKLY_RPT_ENDDATE],SOURCE_TABLE[ARRIVALDATE].[Date],DAY))/7)+1,1)

When I build my visualizations, I place a filter for WEEKSAGO>0 and WEEKSAGO<14


Thanks for your input! Unfortunately, that is not the same scenario. In my case we want to show data for 4 weeks back depends what week the user selects in slicer.  so if user selects week 14 of the year, I want to see weeks: 11,12,13 and 14 on my X axis, when user selects week 20 -- I want X axis to adjust to show 17,18,19, 20.... for some reason filtering does not interact well whit selected value.. 

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.

Top Solution Authors