Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
2 years ago
Solved

TOTALYTD Question

Here is my data Category Jan-24 Feb-24 Mar-24 Apr-24 May-24 Comm  61,742,741  68,152,538  68,794,916  66,809,865  42,966,036 Md  27,267,359  28,160,052  28,267,516  27,198,823...
  • rajendraongole1's avatar
    rajendraongole1
    2 years ago

    Hi Anonymous - Please create a seperate Date table, it works. 

     

    Did I answer your question? Mark my post as a solution! This will help others on the forum!
    Appreciate your Kudos!!

  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi Anonymous ,

    Please try:

    Charges YTD = 
    VAR LastMonthAvailable = MAX ( 'Calendar'[Month-Year-Sort] )
    VAR LastYearAvailable = MAX ( 'Calendar'[Year] )
    VAR Category = MAX( 'Table1'[Category] )
    VAR Result =
        CALCULATE (
            [Total Charges],
            REMOVEFILTERS ( 'Calendar' ),
            'Calendar'[Month-Year-Sort] <= LastMonthAvailable,
            'Calendar'[Year] = LastYearAvailable,
            VALUES('Table1'[Category])
        )
    RETURN
        Result

    or:

    Charges YTD 2 = CALCULATE([Total Charges],DATESYTD('Calendar'[Date]),VALUES('Table1'[Category]))

    or:

    Charges YTD 3 = TOTALYTD([Total Charges],'Calendar'[Date],VALUES(Table1[Category]))

     

    Best Regards,
    Gao

    Community Support Team

     

    If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
    If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

    How to get your questions answered quickly --  How to provide sample data in the Power BI Forum -- China Power BI User Group