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,
I have a requirement to create a clustered column chart that can be filtered in a specific way by a date slicer.
The chart needs to display sales by month (x-axis) and year legend. The user has a date slicer and need to be able to set the last date to display on the chart, but it needs to limit previous years also.
This means if the user selects the date june 1th of 2022 in the slicer and we have 3 years of sales data, the chart would display
The data model is a simple fact table with sales linked to a calendar dimension.
Would it be possible to create one dax measure for this calculation ?
Thanks in advance
Hi,
But in your case it takes the whole month, right ?
In my requirement I have to filter up to the date selected, meaning if the date 6/15/2022 is selected, the sum should from 1/1/YYYY to 6/15/YYYY for each year.
Hi,
For LY calculation using SAMEPERIODLASTYEAR combined with calendar should do what you want. So e.g.
CALCULATE ( [measure], SAMEPERIODLASTYEAR ( 'Calendar'[Date]))
Alternatively you could construct the dates for DATESBETWEEN e.g. (use the _ly and _ly2 to create last year and two years ago measures:
Proud to be a Super User!
Hi @ValtteriN ,
Thanks for your answer.
I thought about having more than 1 measure. However, the user has to be able to see all the years available from the dataset, so that means we would have to create an undefinite number of measure (y, y-1, y-2, ...).
Do you think there is a way to do this in a single measure with dax ?
Hi,
I see what you are trying to achieve. I should be possible. Here is an example:
Data:
Relationship:
In this case you might not even need dax or jut use simple SUM(table[column])
If you only want last 3 years you can apply a visual level filter where you define this:
Proud to be a Super User!
Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!
Check out the October 2025 Power BI update to learn about new features.
User | Count |
---|---|
12 | |
12 | |
11 | |
10 | |
9 |