Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!
Hi there,
I'm doing a report where I don't have a date calendar. So I can't use TI functions like SAMEPERIODLASTYEAR or DATEADD, because the only thing that is relevant in my data are the seasons e.g. season 2002/2003, 2003/2004 ..... 2020/2021
In this scenario, when creating a KPI, how can I create a measure that changes dynamically based on the filters that I select? So when I filter on 2018/2019.
My KPI shows that year + previous year (2017/2018). When I select 2006/2007, my KPI shows that year + previous year (2005/2006).
Someone who has an idea?
Solved! Go to Solution.
Hi @Gjakova
Try this measure.
Current+PrevYear =
VAR selectedYearKey = SELECTEDVALUE(Years[Year_KEY])//Decide how will you handle no selection and mutiple selection
VAR PrevYearKey = selectedYearKey - 1
Return SUMX(
FILTER(ALL(Scores), Scores[Year_KEY] in {selectedYearKey, PrevYearKey})
, Scores[Score])
Hope this helps.
Please mark it as a solution if it serves the purpose.
Thanks
@Gjakova solution attached
I would ❤ Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos whoever helped to solve your problem. It is a token of appreciation!
⚡Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.⚡
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
Hi @Gjakova
Try this measure.
Current+PrevYear =
VAR selectedYearKey = SELECTEDVALUE(Years[Year_KEY])//Decide how will you handle no selection and mutiple selection
VAR PrevYearKey = selectedYearKey - 1
Return SUMX(
FILTER(ALL(Scores), Scores[Year_KEY] in {selectedYearKey, PrevYearKey})
, Scores[Score])
Hope this helps.
Please mark it as a solution if it serves the purpose.
Thanks
@Gjakova , Prefer to have separate Year table atleast , Try to use numeric year or rank to get that.
With date/year table
This Year = CALCULATE(sum('order'[Qty]),filter(ALL('Date'),'Date'[Year]=max('Date'[Year])))
Last Year = CALCULATE(sum('order'[Qty]),filter(ALL('Date'),'Date'[Year]=max('Date'[Year])-1))
check option of without using time intelligence
Power BI — YTD Questions — Time Intelligence 1–5
https://medium.com/@amitchandak.1978/power-bi-ytd-questions-time-intelligence-1-5-e3174b39f38a
@Gjakova solution attached
I would ❤ Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos whoever helped to solve your problem. It is a token of appreciation!
⚡Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.⚡
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
Hi @amitchandak, unfortunalety I can't work with date tables. I also don't work with full years, but with seasons. So season 2017/2018 etc.
If you have time, could you perhaps try your method out with my sample data? I tried it, but I can't get it to work. Hope to hear from you!
@Gjakova if you have number field that identifies the order of the year, you can achieve this using following measure
Previous Year =
VAR __id = MAX ( TableYear[Id] )
VAR __prevId = __id - 1
RETURN
CALCULATE ( SUM ( Table[Amount] ), TableYear[Id] = __prevId )
I would ❤ Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos whoever helped to solve your problem. It is a token of appreciation!
⚡Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.⚡
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
I tried your answer, but it partly works @parry2k
When I put my measure in a table and also the years, than it only shows the total previous, but the years stay blank.
Could you perhaps try it out with my sample data and see if you manage to make it work? If it works then I can replicate that same trick on my real dataset. Many thanks in advance!
User | Count |
---|---|
141 | |
113 | |
104 | |
78 | |
64 |
User | Count |
---|---|
136 | |
125 | |
107 | |
70 | |
61 |