Forum Discussion
Anonymous
5 years agoNot 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( ...
- 5 years ago
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.
Angith_Nair
Continued Contributor
5 years agoHi 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.
- Anonymous5 years agoNot applicable
Thanks