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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
joshua1990
Post Prodigy
Post Prodigy

Show Past based on selected Week

Hi experts!

I have a simple bar chart that shows our Sales per Week.

Now I would like to add a slicer / filter to select the last week that should be include into the chart.

For instance, when I select Week 22 I just want to see all sales until week 22.

How can I do this using dax?

THis approach doesn't work:

CALCULATE (
        [Sales],
        FILTER (
            ALL ( 'Calendar' ),
            'Calendar'[Year] = VALUES ( 'Calendar'[Year] )
                && 'Calendar'[Week] <= MAX ( 'Calendar'[Week] )
        )
    )
1 ACCEPTED SOLUTION
johnt75
Super User
Super User

Try

Sales up to week =
var maxDate = MAX('Calendar'[Date])
return CALCULATE( [Sales], REMOVEFILTERS('Calendar'), 'Calendar'[Date] <= maxDate )

View solution in original post

5 REPLIES 5
johnt75
Super User
Super User

Use Performance Analyser to get the DAX code generated for the visual, check what filters are being applied in there.

johnt75
Super User
Super User

Try

Sales up to week =
var maxDate = MAX('Calendar'[Date])
return CALCULATE( [Sales], REMOVEFILTERS('Calendar'), 'Calendar'[Date] <= maxDate )

Ok, I have found the issue.

Now I get the sum of all past weeks display in the selected week.

Just 1 week is displayed in the visual but is sums all past weeks. How can I get the value per week for each week?

I would think your normal [Sales] measure would do that

Thanks @johnt75 , bot nothing changes. I still see just 1 week if I filter on the slicer on 1 week.

 

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

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.