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! Request now

Reply
Daredevilz
Regular Visitor

Show previous 4 weeks value of Dax based on selected week value in slicer

I have a multiple DAX which are giving me different parameters value.

I have a slicer of week selection in my report.

Now I want to show graph of last 4 weeks values of all DAX measure in graph based on single selection in week slicer.

For eg. In slicer if i selected 45, in graph it should x axis as 41, 42,43 and 44 against which i get DAX values.

 

I have a dim_date column which has date,weekofyear and other columns. That dim_date is one dimension date table used in the report.

1 ACCEPTED SOLUTION
saurabhtd
Resolver II
Resolver II

@DaredevilzHere is the DAX logic which might work in your case. 

 

Previous 4 Weeks Value = 
VAR SelectedWeek = SELECTEDVALUE(dim_date[WeekofYear])
RETURN
CALCULATE(
    [Base Measure],
    FILTER(
        ALL(dim_date),
        dim_date[WeekofYear] >= SelectedWeek - 4 && dim_date[WeekofYear] < SelectedWeek
    )
)

 

I you want to create line chart or bar chart. Add the Previous 4 Weeks Value measure to the y-axis and
Add the dim_date[WeekofYear] column to the x-Axis.

 

View solution in original post

1 REPLY 1
saurabhtd
Resolver II
Resolver II

@DaredevilzHere is the DAX logic which might work in your case. 

 

Previous 4 Weeks Value = 
VAR SelectedWeek = SELECTEDVALUE(dim_date[WeekofYear])
RETURN
CALCULATE(
    [Base Measure],
    FILTER(
        ALL(dim_date),
        dim_date[WeekofYear] >= SelectedWeek - 4 && dim_date[WeekofYear] < SelectedWeek
    )
)

 

I you want to create line chart or bar chart. Add the Previous 4 Weeks Value measure to the y-axis and
Add the dim_date[WeekofYear] column to the x-Axis.

 

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.