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
hb0135
Helper III
Helper III

Need latest four week to show in column chart automatically not select it from filter

Hello,
I have all weeks data in column chart but in that only latest four weeks to be shown automatically not selecting the filter/slicer below is the shown image.
In this i want see wk 28,27,26,25 and if week changes then the current week and last 3 weels data should be seen autmatically

hb0135_0-1752462669571.png

Regards
Atharva

1 ACCEPTED SOLUTION
Jihwan_Kim
Super User
Super User

Hi,

I am not sure how your semantic model looks like, but I tried to create a sample pbix file like below.

Please check the below picture and the attached pbix file.

 

Jihwan_Kim_1-1752465011185.png

 

 

Jihwan_Kim_0-1752464991980.png

 

WINDOW function (DAX) - DAX | Microsoft Learn

 

Sales latest 4 weeks: = 
VAR _t =
    WINDOW (
        1,
        ABS,
        4,
        ABS,
        ALL ( 'calendar'[Year Week], 'calendar'[Start of Week] ),
        ORDERBY ( 'calendar'[Start of Week], DESC )
    )
RETURN
    CALCULATE ( SUM ( sales[sales] ), KEEPFILTERS ( _t ) )

 


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.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

View solution in original post

3 REPLIES 3
mdaatifraza5556
Super User
Super User

Hi @hb0135 

Can you please try this to get your last week result.

Add visual level filter.

Drag Date column to the visual level filter and then in filter type set Relative date and as shown in the snapshot.

Screenshot 2025-07-14 093152.png

 


If this answers your questions, kindly accept it as a solution and give kudos.

danextian
Super User
Super User

Hi @hb0135 

 

Is that automatic based on the latest week or based on slicer selection? Also, what if the last four weeks are from two different years?

 

Please provide a workable sample data (not an image), your expected result from the same sample data and your reasoning behind. You may post a link to Excel or a sanitized copy of your PBIX stored in the cloud.





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.
Jihwan_Kim
Super User
Super User

Hi,

I am not sure how your semantic model looks like, but I tried to create a sample pbix file like below.

Please check the below picture and the attached pbix file.

 

Jihwan_Kim_1-1752465011185.png

 

 

Jihwan_Kim_0-1752464991980.png

 

WINDOW function (DAX) - DAX | Microsoft Learn

 

Sales latest 4 weeks: = 
VAR _t =
    WINDOW (
        1,
        ABS,
        4,
        ABS,
        ALL ( 'calendar'[Year Week], 'calendar'[Start of Week] ),
        ORDERBY ( 'calendar'[Start of Week], DESC )
    )
RETURN
    CALCULATE ( SUM ( sales[sales] ), KEEPFILTERS ( _t ) )

 


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.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

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!

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.

Top Kudoed Authors