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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
vrv
Helper II
Helper II

DAX expression for yearly total

hello all,

how do I write a DAX expression that is equivalent to the following SQL statement:

select YEAR(myDATE), SUM(myAMOUNT)
from myTABLE
group by YEAR(myDATE)
order by YEAR(myDATE)

 

The result is the sum of myAMOUNT by Year:

Year   myAMOUNT

2019  120 

2020  150 

2021  110 

2022  160

 

Thanks,

vrv

2 ACCEPTED SOLUTIONS
Idrissshatila
Super User
Super User

Hello @vrv ,

 

so what you need is a dax measure that sums the amount 

Myamount = sum(tablename[myamount])

 

then you display this measure alongside with the year dimension and you would be able to see the values as you want.

 

If I answered your question, please mark my post as solution, Appreciate your Kudos 👍

Follow me on Linkedin



Did I answer your question? Mark my post as a solution! Appreciate your Kudos
Follow me on LinkedIn linkedIn
Vote for my Community Mobile App Idea

Proud to be a Super User!




View solution in original post

Idrisshatila,

thank you for your reply.

If I were to need the sum of Amount of only some records that have some flag field set on 1, how would the DAX expression change?

View solution in original post

2 REPLIES 2
Idrissshatila
Super User
Super User

Hello @vrv ,

 

so what you need is a dax measure that sums the amount 

Myamount = sum(tablename[myamount])

 

then you display this measure alongside with the year dimension and you would be able to see the values as you want.

 

If I answered your question, please mark my post as solution, Appreciate your Kudos 👍

Follow me on Linkedin



Did I answer your question? Mark my post as a solution! Appreciate your Kudos
Follow me on LinkedIn linkedIn
Vote for my Community Mobile App Idea

Proud to be a Super User!




Idrisshatila,

thank you for your reply.

If I were to need the sum of Amount of only some records that have some flag field set on 1, how would the DAX expression change?

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.