Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.
I would like to know if there is a way to display dynamically last 12 months data based on Year/Quarter/Month Selection
Tried Many ways but couldnt achieve with Date Hirearchy filter.
If user selects 2021 Q1 ..It should display last 12 months data with axis 2021.01 , 2021.02 , 2021.03 , 2020.12 , 2020.11 , 2020.10 etc
if user selects 2021 March ..It should display march data along with last 12 months data.
Any help would be appreciated 🙂
Solved! Go to Solution.
Hi,
There are multiple ways to do this. One of the more straightforward ways is to make a copy of your calendar table:
Now create measure with following dax:
The visual uses calendar[Date] and slicer calendar_for_visual[date]
Proud to be a Super User!
It was useful for me.
I thought about sharing this tutorial for anyone who would have the same issue but with other visuals where you don't want to activate the relationships between the two calendar tables in every single mesures and keep your dates fields from your main calendar table.
Show last 6 months based on user single slicer selection from SQLBI
Hi @ValtteriN
I followed the same process as you said but the visual displaying whatever month i selected instead of last 12 months, not sure where i missed .
Hi,
Is your relationship M:1 and inactive with filter direction "single" like in my example? Another possible problem might be with the slicer visual. Are you using 'Calendar for visual' table as the slicer? At a glance your DAX seems to follow the same logic so the problem is with visual or relationships.
Proud to be a Super User!
Hi,
There are multiple ways to do this. One of the more straightforward ways is to make a copy of your calendar table:
Now create measure with following dax:
The visual uses calendar[Date] and slicer calendar_for_visual[date]
Proud to be a Super User!
Hi,
Thank you for your reply. Actually I want my trend chart shows last 12 months as default chart view but if any Date filter is selected then the chart/measure should "reset" this 12 months period from the chart view and behave like a standard view that reacts on the slicer selection i.e if user selects "January" it should show January only and not January with previous 12 months...Hope this explanaition is clear now.
This very interesting solution. However I would like to modify it a bit and maybe it will be easy for you support me. I follow you guidance and everything works perfect but I would like my Last12Month works only when no "Date" filter/slicer is applied. If user select on the slicer specific month or year ect. then the measure should show exact selected period (with no additional previous 12 months data). Is there a way that we can doi it?
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.
User | Count |
---|---|
17 | |
10 | |
10 | |
8 | |
6 |
User | Count |
---|---|
18 | |
16 | |
15 | |
12 | |
10 |