Forum Discussion
Florcita
1 year agoRegular Visitor
Problem with a measure to compare values
Hi guys! How are you? I need some help! I dont know how to calculate a DAX measure. I tried several ways and failed to do it. On one hand, i have a measure that cumulatively summarizes "operatio...
- 1 year ago
Hi! You can use the below DAX:
AmountLastMonthToDate =VAR TodayDate = TODAY()VAR StartOfCurrentMonth = DATE(YEAR(TodayDate), MONTH(TodayDate), 1)VAR EndOfCurrentMonth = TodayDateVAR StartOfLastMonth = EOMONTH(TodayDate, -2) + 1VAR EndOfLastMonth = EOMONTH(TodayDate, -1)VAR LastMonthToDate = DATESBETWEEN('YourDateTable'[Date],StartOfLastMonth,StartOfLastMonth + DAY(TodayDate) - 1)RETURNCALCULATE([Operation Fee,LastMonthToDate)I created the below sample data:Then, I added the date to filters on this page (you could also use all pages) and set it to relative date for in this month:
audreygerred
1 year agoSuper User
Hi! You can use the below DAX:
AmountLastMonthToDate =
VAR TodayDate = TODAY()
VAR StartOfCurrentMonth = DATE(YEAR(TodayDate), MONTH(TodayDate), 1)
VAR EndOfCurrentMonth = TodayDate
VAR StartOfLastMonth = EOMONTH(TodayDate, -2) + 1
VAR EndOfLastMonth = EOMONTH(TodayDate, -1)
VAR LastMonthToDate = DATESBETWEEN(
'YourDateTable'[Date],
StartOfLastMonth,
StartOfLastMonth + DAY(TodayDate) - 1
)
RETURN
CALCULATE(
[Operation Fee,
LastMonthToDate
)
I created the below sample data:
Then, I added the date to filters on this page (you could also use all pages) and set it to relative date for in this month: