cancel
Showing results for
Did you mean:  Post Prodigy

## My GL YTD measure return wrong result how to make it correct ?

Hi All

I have below measure which is working :-

_LYTD EXP = CALCULATE([AMOUNT],GL[1_EXP]="EXP",DATESBETWEEN('Date'[Date],date(year(today())-1,1,1),eomonth(today(),-13)+1))
it return correct amount = 910 693.85

i try to convert the above measure to more structure way , so that i can modify to LYTD :-
_LYTD_EXP =
var _max = date(year(today())-1,month(today()),day(today()))
return

But it return wrong value , can some one share with me why ? and how to make it return 910 693.85 https://www.dropbox.com/s/9pmrb7teaoiqw7g/PBT_V2021_397%20GL_TS%20SAMPLE.pbix?dl=0

My PBI file above link :-

Paul

1 ACCEPTED SOLUTION  Community Support

I think I know what the problem is.

the before measure:

``````_LYTD EXP =
CALCULATE (
[AMOUNT],
GL[1_EXP] = "EXP",
DATESBETWEEN (
'Date'[Date],
DATE ( YEAR ( TODAY () ) - 1, 1, 1 ),
EOMONTH ( TODAY (), -13 ) + 1
)
)``````

Just as below,when i use the date mesuare,I get  the date calculate is 2020/1/1 to 2020/4/1  And when  I tried another measure, I get the date is to 2020/4/16 not 2020/4/1 ,due to this ,the two measure is different . You also could use the following measure ,

``````_LYTD_EXP =
VAR _max =
DATE ( YEAR ( TODAY () ) - 1, MONTH ( TODAY () ), 1 )
RETURN
TOTALYTD (
( 'GL'[AMOUNT_EXP] ),
DATEADD ( 'Date'[Date], -1, YEAR ),
'Date'[Date] <= _max
)``````

Final you will get the same value: Wish it is helpful for you!

Best Regards

Lucien

5 REPLIES 5  Community Support

I think I know what the problem is.

the before measure:

``````_LYTD EXP =
CALCULATE (
[AMOUNT],
GL[1_EXP] = "EXP",
DATESBETWEEN (
'Date'[Date],
DATE ( YEAR ( TODAY () ) - 1, 1, 1 ),
EOMONTH ( TODAY (), -13 ) + 1
)
)``````

Just as below,when i use the date mesuare,I get  the date calculate is 2020/1/1 to 2020/4/1  And when  I tried another measure, I get the date is to 2020/4/16 not 2020/4/1 ,due to this ,the two measure is different . You also could use the following measure ,

``````_LYTD_EXP =
VAR _max =
DATE ( YEAR ( TODAY () ) - 1, MONTH ( TODAY () ), 1 )
RETURN
TOTALYTD (
( 'GL'[AMOUNT_EXP] ),
DATEADD ( 'Date'[Date], -1, YEAR ),
'Date'[Date] <= _max
)``````

Final you will get the same value: Wish it is helpful for you!

Best Regards

Lucien  Post Prodigy

@v-luwang-msft Thank you for your sharing  Community Support

Best Regards

Lucien  Post Prodigy

Thank yo for look at my post , below is my PBI file :-

https://www.dropbox.com/s/qfb7nkqqqhxm0kx/PBT_V2021_397%20GL_TS%20SAMPLE.pbix?dl=0

Paul  Super User IV

@admin11 , The max date in dates between is 1-april-2021

Try this in LYTD

``````_LYTD_EXP =

var _max = EOMONTH(date(year(today())-1,month(today()),day(today())),-1)+1
// Rest is same``````

Proud to be a Super User!  Announcements #### Welcome to the User Group Public Preview  