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.
Hi Experts
I am trying to calculate current year Sales Dynamically - I am using the following measure which is returning zero..
Solved! Go to Solution.
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.
Hello @Anonymous ,
try with the measure
CurrentYear = CALCULATE(
SUM('Test Data'[Sales]),
FILTER(ALL(
'Test Data'),'Test Data'[Year]=YEAR(TODAY())))
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.
Thanks
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
106 | |
93 | |
75 | |
62 | |
50 |
User | Count |
---|---|
147 | |
107 | |
105 | |
87 | |
61 |