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.
My database consists of monthly emissions data from three different years (2020, 2019 and 2018).
I've created three measures to filter the total emissions for each year a forth to compare emissions between 2020 and 2018:
Total 2018 = CALCULATE(Emissions,YEAR('Date'[Date])=2018)
Total 2019 = CALCULATE(Emissions,YEAR('Date'[Date])=2019)
Total 2020 = CALCULATE(Emissions,YEAR('Date'[Date])=2020)
Var 2020-2018= [Total 2020] - [Total 2018].
However, I want to have be able to add a month slicer to my dashboard. That is, I want to be able to compare for instance 2020 and 2018 on Jan + Feb + Mar, or any other months combination that I select. But, when I do so and select the months on this slicer, the result from any of these 4 measures does not change. All I can get is the full year comparison.
Solved! Go to Solution.
The conditions within CALCULATE remove and replace the existing filter context, so slicing on month doesn't change anything since that filter gets replaced.
Try wrapping the conditions with KEEPFILTERS to preserve existing filters.
Total 2018 = CALCULATE ( Emissions, KEEPFILTERS ( YEAR ( 'Date'[Date] ) = 2018 ) )
The conditions within CALCULATE remove and replace the existing filter context, so slicing on month doesn't change anything since that filter gets replaced.
Try wrapping the conditions with KEEPFILTERS to preserve existing filters.
Total 2018 = CALCULATE ( Emissions, KEEPFILTERS ( YEAR ( 'Date'[Date] ) = 2018 ) )
It worked perfectly!
Thank you very much!
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 |
---|---|
123 | |
78 | |
49 | |
38 | |
37 |
User | Count |
---|---|
196 | |
80 | |
70 | |
51 | |
42 |