cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
admin11
Post Prodigy
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
TOTALYTD(('GL'[AMOUNT_EXP]),dateadd('Date'[Date],-1,year),'Date'[Date]<=_max)
 
But it return wrong value , can some one share with me why ? and how to make it return 910 693.85
Paul
 


 
1 ACCEPTED SOLUTION
v-luwang-msft
Community Support
Community Support

Hi @admin11  ,

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

v-luwang-msft_0-1618558217315.pngv-luwang-msft_1-1618558237403.png

 

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 .

 

v-luwang-msft_2-1618558352045.png

 

 

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:

v-luwang-msft_3-1618558483857.png

 

 

Wish it is helpful for you!

 

Best Regards

Lucien

View solution in original post

5 REPLIES 5
v-luwang-msft
Community Support
Community Support

Hi @admin11  ,

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

v-luwang-msft_0-1618558217315.pngv-luwang-msft_1-1618558237403.png

 

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 .

 

v-luwang-msft_2-1618558352045.png

 

 

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:

v-luwang-msft_3-1618558483857.png

 

 

Wish it is helpful for you!

 

Best Regards

Lucien

View solution in original post

@v-luwang-msft Thank you for your sharing

v-luwang-msft
Community Support
Community Support

Hi @admin11 , 

When I click your link ,but  could not download your pbix ,could you pls share your file again?

 

Best Regards

Lucien

@v-luwang-msft 

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

amitchandak
Super User IV
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


Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
Dashboard of My Blogs !! YouTube Channel !! Connect on Linkedin

Proud to be a Super User!

Helpful resources

Announcements
PBI User Groups

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Are You Ready?

Test your skills now with the Cloud Skills Challenge.

Top Solution Authors