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

Calculate Current Year Sales

Hi Experts

 

I am trying to calculate current year Sales Dynamically - I am using the following measure which is returning zero..

CurrentYear = CALCULATE(
SUM('Test Data'[sales]),
FILTER(ALL(
'Test Data'),YEAR('Test Data'[sales])=YEAR(TODAY())))
 
I have a DimDate Table which link to my Sales Table.....
Date
Year     Date Sales
2020
2020
2021
2021
 
 
1 ACCEPTED SOLUTION
Angith_Nair
Continued Contributor
Continued Contributor

Hi @Anonymous ,

First of all create a calculated column in Test Data table like this..

 

IsCurrentYear =
VAR TodayDate =
    TODAY ()
VAR CurrentYear =
    YEAR ( TodayDate )
RETURN
    'Test Data'[Date Column] >= DATE ( CurrentYear, 01, 01 )

 

This column will return true or false..

After this create a measure like this...

 

Measure =
VAR CurrentYearSales =
    CALCULATE ( SUM ( 'Test Data'[sales] ), 'Test Data'[IsCurrentYear] = TRUE () )
RETURN
    IF ( CurrentYearSales = BLANK (), 0, CurrentYearSales )

 

If this works, kindly mark it as a solution. Appreciate with Kuddos.

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Hello @Anonymous ,

 

try with the measure

CurrentYear = CALCULATE(
SUM('Test Data'[Sales]),
FILTER(ALL(
'Test Data'),'Test Data'[Year]=YEAR(TODAY())))

Angith_Nair
Continued Contributor
Continued Contributor

Hi @Anonymous ,

First of all create a calculated column in Test Data table like this..

 

IsCurrentYear =
VAR TodayDate =
    TODAY ()
VAR CurrentYear =
    YEAR ( TodayDate )
RETURN
    'Test Data'[Date Column] >= DATE ( CurrentYear, 01, 01 )

 

This column will return true or false..

After this create a measure like this...

 

Measure =
VAR CurrentYearSales =
    CALCULATE ( SUM ( 'Test Data'[sales] ), 'Test Data'[IsCurrentYear] = TRUE () )
RETURN
    IF ( CurrentYearSales = BLANK (), 0, CurrentYearSales )

 

If this works, kindly mark it as a solution. Appreciate with Kuddos.

Anonymous
Not applicable

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.