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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Sum value by date

Any1 know what's wrong with below DAX?

2017Exp = calculate(sum(XeroMasterExport[ActualExp]),XeroMasterExport[Date]=2017)

 

CRM.PNG

1 ACCEPTED SOLUTION
Sean
Community Champion
Community Champion

Yes you need to use the YEAR function

 

2017Exp =
CALCULATE (
    SUM ( XeroMasterExport[ActualExp] ),
    YEAR ( XeroMasterExport[Date] ) = 2017
)

HTH! Smiley Happy

 

EDIT: Well you may need to use this instead if you are using any slicers that cause the above to give you blank

 

2017Exp =
CALCULATE (
    SUM ( XeroMasterExport[ActualExp] ),
    FILTER ( ALL ( XeroMasterExport ), YEAR ( XeroMasterExport[Date] ) = 2017 )
)

View solution in original post

2 REPLIES 2
Sean
Community Champion
Community Champion

Yes you need to use the YEAR function

 

2017Exp =
CALCULATE (
    SUM ( XeroMasterExport[ActualExp] ),
    YEAR ( XeroMasterExport[Date] ) = 2017
)

HTH! Smiley Happy

 

EDIT: Well you may need to use this instead if you are using any slicers that cause the above to give you blank

 

2017Exp =
CALCULATE (
    SUM ( XeroMasterExport[ActualExp] ),
    FILTER ( ALL ( XeroMasterExport ), YEAR ( XeroMasterExport[Date] ) = 2017 )
)
Anonymous
Not applicable

@Seanworked, easy, i love this place!!  thanks!

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.