Forum Discussion
problem with measure
- 2 years ago
emma313823
Filter accepts only one argument, If you need to provide 2 arguments(month and year) you need to use &&.
Also for previous month use below dax.
Prevmonth = =
CALCULATE(
SUM('tblIncomingCommissions'[Check_Value]),
FILTER(
'Calendar_Dates',
MONTH('Calendar_Dates'[Date]) = MONTH(TODAY())-1 &&
YEAR('Calendar_Dates'[Date]) = YEAR(TODAY())
)
)
But this will remain static(change each month automatically), But if you want the user to select what the current month is. Then create two slicers for year and month. When use select a year and a month the below dax will give current and previous month.
CM = SUM('tblIncomingCommissions'[Check_Value])
Previous month = calculate(CM,PREVIOUSMONTH(datecolumn))
If this post helps, then please consider Accept it as the solution to help the others find it more quickly. Appreciate you kudos!!
Follow me on LinkedIn!!!
Hi emma313823
please try below DAX.
CurrentMoComm =
CALCULATE(
SUM('tblIncomingCommissions'[Check_Value]),
FILTER(
'Calendar_Dates',
MONTH('Calendar_Dates'[Date]) = MONTH(TODAY()) &&
YEAR('Calendar_Dates'[Date]) = YEAR(TODAY())
)
)
If this post helps, then please consider Accept it as the solution to help the others find it more quickly. Appreciate you kudos!!
Follow me on LinkedIn!!
Could you help me a bit understanding what I did wrong?
- NaveenGandhi2 years agoMemorable Member
emma313823
Filter accepts only one argument, If you need to provide 2 arguments(month and year) you need to use &&.
Also for previous month use below dax.
Prevmonth = =
CALCULATE(
SUM('tblIncomingCommissions'[Check_Value]),
FILTER(
'Calendar_Dates',
MONTH('Calendar_Dates'[Date]) = MONTH(TODAY())-1 &&
YEAR('Calendar_Dates'[Date]) = YEAR(TODAY())
)
)
But this will remain static(change each month automatically), But if you want the user to select what the current month is. Then create two slicers for year and month. When use select a year and a month the below dax will give current and previous month.
CM = SUM('tblIncomingCommissions'[Check_Value])
Previous month = calculate(CM,PREVIOUSMONTH(datecolumn))
If this post helps, then please consider Accept it as the solution to help the others find it more quickly. Appreciate you kudos!!
Follow me on LinkedIn!!!