Forum Discussion
Exclude current month
- 2 years ago
Hi Oros ,
You just nned to apply filter in your DAX MeasureSales_Excluding_Current_Month = VAR CurrentMonth = MONTH(TODAY()) VAR CurrentYear = YEAR(TODAY()) RETURN CALCULATE( SUM(Sales[SalesAmount]), FILTER( Sales, YEAR(Sales[Date]) < CurrentYear || (YEAR(Sales[Date]) = CurrentYear && MONTH(Sales[Date]) < CurrentMonth) ) )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! - 2 years ago
Oros
you should use a date table/Calender table and use the measure below.
Total Sales =
VAR CurrentMonth = MAX('Date'[Date])
VAR LastMonth = CALCULATE(MAX('Date'[Date]), ALL('Date'))
RETURN
IF(
CurrentMonth = LastMonth,
BLANK(), -- Exclude current month if it's the last available month
CALCULATE(
SUM('Sales'[SalesAmount]),
FILTER(
ALL('Date'),
'Date'[Date] <= LastMonth -- Include months up to the last completed month
)
)
)Did I answer your question? Mark my post as a solution! Appreciate your Kudos !!
Oros
you should use a date table/Calender table and use the measure below.
Total Sales =
VAR CurrentMonth = MAX('Date'[Date])
VAR LastMonth = CALCULATE(MAX('Date'[Date]), ALL('Date'))
RETURN
IF(
CurrentMonth = LastMonth,
BLANK(), -- Exclude current month if it's the last available month
CALCULATE(
SUM('Sales'[SalesAmount]),
FILTER(
ALL('Date'),
'Date'[Date] <= LastMonth -- Include months up to the last completed month
)
)
)
Did I answer your question? Mark my post as a solution! Appreciate your Kudos !!
- Oros2 years agoPost Prodigy