Forum Discussion

NewbieJono's avatar
NewbieJono
Post Partisan
1 year ago
Solved

Same Day previous Year

Hello, I have some Dax to get from the previous year, which seems to work. but for some reason, the total volume is completely wrong, There is a filter of 3 weeks applied to the table   Same Day P...
  • Anonymous's avatar
    Anonymous
    1 year ago

    Hi NewbieJono 

     

    Thanks for the reply from Greg_Deckler .

     

    The following testing is for your reference.

     

    Sample:

     

    Create two measures as follow

    This year = CALCULATE(SUM('FACT -Receipts'[Value]) , FILTER('FACT -Receipts', [Date] >= MIN('DIM - Date Table'[Date]) && [Date] <= MAX('DIM - Date Table'[Date])))

     

    Same Day previous Year = 
    CALCULATE (
        SUM ( 'FACT -Receipts'[Value] ),
        FILTER (
            'FACT -Receipts',
            [Date]
                >= DATE ( YEAR ( MIN ( 'DIM - Date Table'[Date] ) ) - 1, MONTH ( MIN ( 'DIM - Date Table'[Date] ) ), DAY ( MIN ( 'DIM - Date Table'[Date] ) ) )
                && [Date]
                    <= DATE ( YEAR ( MAX ( 'DIM - Date Table'[Date] ) ) - 1, MONTH ( MAX ( 'DIM - Date Table'[Date] ) ), DAY ( MAX ( 'DIM - Date Table'[Date] ) ) )
        )
    )

     

    Output:

     

    Best Regards,
    Yulia Xu

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.