Forum Discussion

FR14's avatar
FR14
Icon for Helper I rankHelper I
2 years ago
Solved

LY YTD (total)

Hi Everyone,   Using following formula below, i am able to get the LY YTD for the exact month and day amount BUT when i fliter all the months the total LY YTD doesn't show correct amount, do you g...
  • StrategicSavvy's avatar
    2 years ago

    hi FR14 

     

    I belive you can use DATESYTD function based on your calendar table.  Make sure you have properly built di calendar table as Jihwan_Kim  mentioned before you go.

     

    First create measure that will make you are not showing values for future dates in your calendar table:

    ShowValueForDates :=
    VAR LastDateWithData =
        CALCULATE (
            MAX ( OrderLine[Open_Date] ),
            REMOVEFILTERS ()
        )
    VAR FirstDateVisible =
        MIN ( 'Date'[Date] )
    VAR Result =
        FirstDateVisible <= LastDateWithData
    RETURN
        Result

     

    Secondly create this measure:

     

    LY YTD Bookings = 
    IF(
        [ShowValueForDates],
        CALCULATE(
            SUM ( OrderLine[Booking USD] ),
            DATESYTD('Date'[Date])
        )
    )

     

    I hope this post helps to solve your issue and if it does consider accepting it as a solution and giving the post a thumbs up!

    My LinkedIn: www.linkedin.com/in/lukasz-kozdron