Forum Discussion

PBIBeginner2022's avatar
PBIBeginner2022
Helper III
4 years ago
Solved

DAX : Sum previous month automatically

Hello,   I would like to translate this into DAX language:   I have a column calculated with the value of each item sold and a column with the date of sale of each item. I would like to create a...
  • Anonymous's avatar
    Anonymous
    4 years ago

    Hi PBIBeginner2022 ,

     

    This formula should work.

    Pre_sales =
    CALCULATE (
        SUM ( 'Table'[Price] ),
        FILTER (
            ALLSELECTED ( 'Table' ),
            FORMAT ( 'Table'[Date], "YYYYMM" ) = FORMAT ( EDATE ( TODAY (), -1 ), "YYYYMM" )
        )
    )
    

     

    Best Regards,

    Jay