Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.
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.
User | Count |
---|---|
10 | |
9 | |
7 | |
4 | |
4 |