Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

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.

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
v-yetao1-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
v-yetao1-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.

amitchandak
Super User
Super User

@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()) ) )

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.