Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
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] )
)
)
Solved! Go to Solution.
Try
Sales up to week =
var maxDate = MAX('Calendar'[Date])
return CALCULATE( [Sales], REMOVEFILTERS('Calendar'), 'Calendar'[Date] <= maxDate )
Use Performance Analyser to get the DAX code generated for the visual, check what filters are being applied in there.
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.
Check out the July 2025 Power BI update to learn about new features.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
User | Count |
---|---|
20 | |
7 | |
6 | |
5 | |
5 |
User | Count |
---|---|
26 | |
10 | |
10 | |
9 | |
6 |