Forum Discussion
PBIBeginner2022
4 years agoHelper III
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...
- Anonymous4 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
PBIBeginner2022
4 years agoHelper III
Anonymous I don't have the same value between my display card and the month of may. I think it is missing something in the measure. I think in the measure we filter on all the month of may of every years. So I think we need to add something filter on the month -1 of the current year and not of all the year. I don't know if your understand me. In reality I have more than 50 years in my column and I want only the current month minus one of the current year.
Please, could you help me for this.
Anonymous
4 years agoNot applicable
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