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 every one
I have a slicer with the years 2022, 2023, and 2024, and I'm tracking the total price as a key performance indicator (KPI). When I select 2023 in the slicer, I want to see the total price for both 2022 and 2023. Similarly, if I select 2024, I want to see the total price for 2022, 2023, and 2024.
How can I set this up?
and also if i have financial year (2023-24) instead of year how can i do it
Hi @Anonymous
if we have two slicers like year and month then how can i achieve this
Hi @ajet-p_91 ,
This can be accomplished by making simple changes to his expression.
TotalSum = CALCULATE(SUM('Table'[Value]),'Table'[Date].[Year]<=SELECTEDVALUE('Table'[Date].[Year])&&'Table'[Date].[Month]<=SELECTEDVALUE('Table'[Date].[Month]))
Hope it helps!
Best regards,
Community Support Team_ Scott Chang
If this post helps then please consider Accept it as the solution to help the other members find it more quickly.
Hi @Anonymous
This is the result
Hi @ajet-p_91 ,
Disconnecting dimyear from date seems to work.
An attachment for your reference. Hope it helps!
Best regards,
Community Support Team_ Scott Chang
If this post helps then please consider Accept it as the solution to help the other members find it more quickly.
Hi @Anonymous
Can you give more details about how to do it
Hi @ajet-p_91 ,
Create a year dimension table and use it as a slicer to control the current year versus the previous year that needs to be calculated. Please see the attachment above.
Best regards,
Community Support Team_ Scott Chang
Hi @Anonymous
The current Dax is currently operational, but the pre-Dax is not working. Also, I want data from all previous years, not just last year.
So if I understand your requirements correctly on selecttion of year 2022 the output should be sum of total for year 2022,2023 & 2024. and incase of selection of 2023 the output should be a sum of total for 2023 and 2024.and there can be N number of years following the year that you select.
TotalSum = CALCULATE(SUM('Table'[Value]),'Table'[Date].[Year]>=SELECTEDVALUE('Table'[Date].[Year]))
Hi @ajet-p_91 ,
Please provide sample data as well as expected results.
Best regards,
Community Support Team_ Scott Chang
Hi @Anonymous
It's not working
Hi @ajet-p_91 ,
Where are you stuck? What kind of results are you getting?
Best regards,
Community Support Team_ Scott Chang
Hi @ajet-p_91 ,
If only one measure is used, it seems that it is only possible to realize the totals for viewing two years. It could be last year or any span of years. You can check the results below:
Current = CALCULATE(SUM('Date'[Value]),FILTER('Date',YEAR('Date'[Date])=SELECTEDVALUE('Dim Year'[Year])))
Pre = CALCULATE(SUM('Date'[Value]),FILTER('Date',YEAR([Date])=SELECTEDVALUE('Dim Year'[Year])-1))
Hope it helps!
Best regards,
Community Support Team_ Scott Chang
If this post helps then please consider Accept it as the solution to help the other members find it more quickly.
User | Count |
---|---|
25 | |
11 | |
8 | |
6 | |
6 |
User | Count |
---|---|
30 | |
13 | |
11 | |
9 | |
6 |