Forum Discussion
bipowerbix
Helper I
3 years agoYTD MEASURE NOT WORKING AS INTENDED
Here is the Table named test: Here is the table 2 which contains Dates, which is used as Slicer: Dates = CALENDAR(date(2022,1,1),TODAY()) Link between Dates and test dataset: ...
- 3 years ago
Hi bipowerbix
I got the desired result, please try the below measure.
-------------------------------------------------------
YTD =VAR minim = CALCULATE( MIN( Dates[Date]), ALLSELECTED(Dates[Date])) //12-10-2022var startyear = DATE(YEAR(TODAY()),1,1) // current start year date 1-1-2023var a= if( minim >= startyear ,calculate(sum(test[Totals] ), FILTER(all(Dates), Dates[Date] >= startyear)) ,calculate(sum(test[Totals] ), FILTER(all(Dates), Dates[Date] >= startyear)))return a-------------------------------------------------
--------------------------------------------------------------------------
Regards,
Novil
If I answer your question, please mark my post as a solution.
FreemanZ
Super User
3 years agotry like:
Measure =
SUMX(
FILTER(
ALL(test),
test[date]=YEAR(MAX(dates[date]))
&& test[date]<=TODAY()
)
test[Totals]
)bipowerbix
Helper I
3 years agoDoesn't Work, Gives output as blank. (Image below of Visual titled Measure)
- FreemanZ3 years ago
Super User
hi bipowerbix
there is a typo, try like:
Measure =SUMX(FILTER(ALL(test),YEAR(test[date])=YEAR(MAX(dates[date]))&& test[date]<=TODAY()),test[Totals])