cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
lancea
Helper I
Helper I

Calculate Total for the Current Year

I have the following table:

 

IDDate DescriptionDate MonthDate YearSales
1Dec-2020122020100
2Jan-202112021100
3Jan-20211202150
4Feb-202122021100
5Mar-20213202125
6Mar-20213202175
7Apr-202142021100
8Apr-202142021100

 

I would like to get the following table:

 

Date DescriptionMonthly TotalOverall Year TotalAverage Year Total
Jan-2021150550137.5
Feb-2021100550137.5
Mar-2021100550137.5
Apr-2021200550137.5

 

I was already able to get the Monthly Total just by summing Sales column. How do I create a measure / calculated column to compute for the Overall Year Total and Average Year Total?

1 ACCEPTED SOLUTION
Ailsa-msft
Community Support
Community Support

Hi @lancea 

You can create measures to return Overall Year Total and Average Year Total .

Monthly total = CALCULATE(SUM('Table'[Sales]),ALLEXCEPT('Table','Table'[Date Description]))

Overall Year Total = CALCULATE(SUM('Table'[Sales]),ALLEXCEPT('Table','Table'[Date Year]))

Average Year Total = [Overall Year Total]/CALCULATE(DISTINCTCOUNT('Table'[Date Description]),ALLEXCEPT('Table','Table'[Date Year]))

Then put the measures with fields ‘Date Description’ and ‘Date Year’ in a new table visual ,like this

Ailsa-msft_0-1623399472162.png

In ‘Date Year’ filter , filter out data for 2020 .

Ailsa-msft_1-1623399472163.png

I have attached my pbix file , you can refer to it .

 

Best Regards

Community Support Team _ Ailsa Tao

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
Ailsa-msft
Community Support
Community Support

Hi @lancea 

You can create measures to return Overall Year Total and Average Year Total .

Monthly total = CALCULATE(SUM('Table'[Sales]),ALLEXCEPT('Table','Table'[Date Description]))

Overall Year Total = CALCULATE(SUM('Table'[Sales]),ALLEXCEPT('Table','Table'[Date Year]))

Average Year Total = [Overall Year Total]/CALCULATE(DISTINCTCOUNT('Table'[Date Description]),ALLEXCEPT('Table','Table'[Date Year]))

Then put the measures with fields ‘Date Description’ and ‘Date Year’ in a new table visual ,like this

Ailsa-msft_0-1623399472162.png

In ‘Date Year’ filter , filter out data for 2020 .

Ailsa-msft_1-1623399472163.png

I have attached my pbix file , you can refer to it .

 

Best Regards

Community Support Team _ Ailsa Tao

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

amitchandak
Super User IV
Super User IV

@lancea , Try measures like, with help from date table

 

This year Today =
var _min = today()
return
CALCULATE(sum('Table'[Sales]), FILTER('Date','Date'[Date] = year(today()) ) )

 

 

overall This year Today =
var _min = today()
return
CALCULATE(sum('Table'[Sales]), FILTER(ALL('Date'),'Date'[Date] = year(today()) ) )

 

 

overall avg This year Today =
var _min = today()
return
CALCULATE(Avergae('Table'[Sales]), FILTER(ALL('Date'),'Date'[Date] = year(today()) ) )



Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
Dashboard of My Blogs !! YouTube Channel !! Connect on Linkedin

Proud to be a Super User!

Thank you for this! The Overall Year Total works! However, I am getting incorrect result from the average as seen in the screenshot below:

 

lancea_0-1623233534330.png

 

Helpful resources

Announcements
PBI User Groups

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group!

MBAS on Demand

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

July 2021 Update 768x460.png

Check it out!

Click here to read more about the July 2021 Updates

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Top Solution Authors
Top Kudoed Authors