Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

calculate current week data using current week and previous week info in DAX

Hi, I hope everyone's well. I am trying to create a measure that uses previous week and current week data. The table looks like the following-   week_end profit loss reference_for_1_may ne...
  • tamerj1's avatar
    4 years ago

    Hi Anonymous 
    Here is the sample file with the solution https://www.dropbox.com/t/6o38jT13uTKnx2Fh

    New Column

    net_product_margin_calculated = 
    VAR ReferenceValue = 342335
    VAR FirstDateEver = MIN ( 'P&L'[week_end] )
    RETURN
        SUMX ( 
            FILTER ( 
                'P&L', 
                'P&L'[week_end] <= EARLIER ( 'P&L'[week_end] ) 
                    && 'P&L'[week_end] > FirstDateEver
            ), 
            'P&L'[profit] - 'P&L'[loss]
        ) 
        + ReferenceValue