Forum Discussion
DateYTD duplicating values for future dates
Hi,
Im having the following problem:
As you can see the November and December data is the same as in October, what Im expecting is that those two month should be 0 or empty.
How can I
The measure Im using is:
- Anonymous4 years ago
Hi Anonymous ,
You could refer the below measure to get the last month average YTD.
last month average YTD = AVERAGEX(FILTER(ALLSELECTED('Table'),MONTH('Table'[date])<=MONTH(SELECTEDVALUE(DIM_TIME[DATETIME]))-1),[Avg Net Net Price YTD])Then compare the average YTD with last month average YTD.
IF([Avg Net Net Price YTD] =[last month average YTD],blank(),[Avg Net Net Price YTD] )
Best Regards,
Jay
3 Replies
- amitchandak
Super User
Anonymous , As per YTD logic that is correct. Because Nov is sum of data till Nov , So have data for all other months other than last 2.
You can limit it
Avg Net Net Price YTD =
var _max = maxx(allselected(Table), Table[Date]) // Table of Net price
return
CALCULATE([Avg Net Net Price],DATESYTD(DIM_TIME[DATETIME]), DIM_TIME[DATETIME] <= _max)
or
Avg Net Net Price YTD =
var _max = maxx(allselected(Table), Table[Date]) // Table of Net price
return
if(DIM_TIME[DATETIME] <= _max , CALCULATE([Avg Net Net Price],DATESYTD(DIM_TIME[DATETIME])) , blank() )
- AnonymousNot applicable
Hi, thanks for your answere.
I tried your solution but I get the same result with this measure:
var _max = maxx(allselected(DIM_TIME), DIM_TIME[DATETIME]) // Table of Net pricereturnCALCULATE([Avg Net Net Price],DATESYTD(DIM_TIME[DATETIME]), DIM_TIME[DATETIME] <= _max)The net price table don't have any DATE field, I have a SK conected to a DATE table: DIM_TIME_SK
- AnonymousNot applicable
Hi Anonymous ,
You could refer the below measure to get the last month average YTD.
last month average YTD = AVERAGEX(FILTER(ALLSELECTED('Table'),MONTH('Table'[date])<=MONTH(SELECTEDVALUE(DIM_TIME[DATETIME]))-1),[Avg Net Net Price YTD])Then compare the average YTD with last month average YTD.
IF([Avg Net Net Price YTD] =[last month average YTD],blank(),[Avg Net Net Price YTD] )
Best Regards,
Jay