Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hello!
I am needing help in calculating annual averages excluding those years not complete (ie 2020). The current measure I am using
CostCenter exclOffsetsAvg =
AVERAGEX ( VALUES ( 'CALENDAR'[Year] ), [CostCenter exclOffsets0] )
Which results in this calculation, The individual years are correct - however I would like to exclude 2020, as obvious only partial year. The real average I want is 15,568.33.
I do want to display the 2020 value, but not include in the overall average.
And while I am asking - is there a way to change the "Total" connotation to "Average"
Thanks in advance - I always get tremendous help from this forum! Appreciated!
Solved! Go to Solution.
@Dellis81 solution attached, change as per your requirement.
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!
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.
@Dellis81 , Try
CostCenter exclOffsetsAvg =
calculate(AVERAGEX ( VALUES ( 'CALENDAR'[Year] ), [CostCenter exclOffsets0] ),'CALENDAR'[Year]<Year(Today()))
OR
CostCenter exclOffsetsAvg =
AVERAGEX (filter( VALUES ( 'CALENDAR'[Year] ),'CALENDAR'[Year]<Year(Today())), [CostCenter exclOffsets0] )
@Dellis81 , Try
CostCenter exclOffsetsAvg =
calculate(AVERAGEX ( VALUES ( 'CALENDAR'[Year] ), [CostCenter exclOffsets0] ),'CALENDAR'[Year]<Year(Today()))
OR
CostCenter exclOffsetsAvg =
AVERAGEX (filter( VALUES ( 'CALENDAR'[Year] ),'CALENDAR'[Year]<Year(Today())), [CostCenter exclOffsets0] )
Thanks for your help - I was able to use your second measure, wrapped inside an if(hasonevalue) statement.
CostCenter exclOffsets =
VAR ExclCurrentYrAvg =
AVERAGEX (
FILTER ( VALUES ( 'CALENDAR'[Year] ), 'CALENDAR'[Year] < YEAR ( TODAY () ) ),
[CostCenter exclOffsets0]
)
RETURN
IF (
HASONEVALUE ( 'CALENDAR'[Year] ),
[CostCenter exclOffsets0],
ExclCurrentYrAvg
)
Thank you!
Thank you - we are closer, but not quite. Your first formula returned the same value 15,568 for all years and total line.
The second formula returned the correct value for 2017,2018,2019, and total. The 2020 year was blank.
My hope was I could include the 2020 value on it's unique report line, but exclude from the average.
Thank you!
@Dellis81 no single clue what you need? Originally you asked avg excluding current year and now you are looking for sum and avg.
It is very hard to provide a solution when the problem is not clearly defined. We are here to help but you need to help us so that we can provide an effective solution. Read this post to get your answer quickly.
https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490
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,
Share the link from where i can download your PBI file. Please only show that table in the file where you are facing a problem.
@Dellis81 solution attached, change as per your requirement.
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!
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.
Thanks for your suggestion. Based on your input, plus another forum member, was able to piece together what I needed. Here is my final measure. Sum of each individual year, with the Total being the average of each year, excluding current yr.
CostCenter exclOffsets =
VAR ExclCurrentYrAvg =
AVERAGEX (
FILTER ( VALUES ( 'CALENDAR'[Year] ), 'CALENDAR'[Year] < YEAR ( TODAY () ) ),
[CostCenter exclOffsets0]
)
RETURN
IF (
HASONEVALUE ( 'CALENDAR'[Year] ),
[CostCenter exclOffsets0],
ExclCurrentYrAvg
)
thank you
Thanks for your quick response - unfortunately we aren't quite there yet. I am needing each individual year to be the SUM, however the total line needs to be the average of all complete years.
I took your measure - and tweaked. And as you can see, the result of 3454 is a sum of 2018 and 2019
Annual Sales wAvgTotal =
IF (
HASONEFILTER ( 'Calendar'[Year] ),
[Sum Sales],
CALCULATE ( AVERAGEx(values('Calendar'[Current Year]), ([Sum Sales] )), 'Calendar'[Current Year] = 0 )
)
I still think I need to be using the averagex iterator - as that works for ALL years. The remedy is to narrow the years down excluding 2020. But, as you can see in the second column - I am still pulling in 2020.
Below is the link to your original file with my foild attempts with yoru dataset
https://drive.google.com/file/d/106gb8DklbFyMiSiLFDYHr0mEbjaX5Kwi/view?usp=sharing
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
106 | |
96 | |
79 | |
66 | |
62 |
User | Count |
---|---|
145 | |
113 | |
105 | |
85 | |
65 |