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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Anonymous
Not applicable

Display X last week based on user selection(week selected)

I have a problem building this formula 

I have a Line Chart showing some values per week 
I need that when a user selects a speceific wekk e.i week 50 the line chart filter to show the Week 50 and 12 Previuos weeks
so the line chart will show info from week 38 up to week 50 

is this possible?

The columns that I use for the Line Chart are just 
Week Number 
and a measure to show a percetange value 

1 ACCEPTED SOLUTION
Jihwan_Kim
Super User
Super User

Hi,

Please check the below picture and attached pbix file.

One of the ways is to create disconnected Week Number Table and use that as a slicer.

 

Picture1.png

 

Sum value: =
VAR weeknumberselect =
SELECTEDVALUE ( 'Week Number'[Week Number], MAX ( 'Week Number'[Week Number] ) )
RETURN
CALCULATE (
SUM ( Data[Value] ),
KEEPFILTERS ( Data[Week Number] <= weeknumberselect
&& Data[Week Number] >= weeknumberselect - 12 )
)

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Go to My LinkedIn Page


View solution in original post

2 REPLIES 2
Jihwan_Kim
Super User
Super User

Hi,

Please check the below picture and attached pbix file.

One of the ways is to create disconnected Week Number Table and use that as a slicer.

 

Picture1.png

 

Sum value: =
VAR weeknumberselect =
SELECTEDVALUE ( 'Week Number'[Week Number], MAX ( 'Week Number'[Week Number] ) )
RETURN
CALCULATE (
SUM ( Data[Value] ),
KEEPFILTERS ( Data[Week Number] <= weeknumberselect
&& Data[Week Number] >= weeknumberselect - 12 )
)

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Go to My LinkedIn Page


VahidDM
Super User
Super User

Hi @Anonymous 

 

Check this link:

 

https://www.vahiddm.com/post/weekly-time-intelligence-dax

 

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
LinkedIn: 
www.linkedin.com/in/vahid-dm/

 

 

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.