Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
So I have this dax measure that returns the previous year's month total charges. However I just want it to return the month to date numbers. For example if today is December 21 2017, then I want to know the total charges from 12/1/16 - 12/21/16 not through 12/31/16.
Here is my measure that returns the same month last year's total instead of month to date:
Charges SDLY MTD = CALCULATE([Charges MTD], SAMEPERIODLASTYEAR(DatesforPivot_PostedDt[Date]))
Solved! Go to Solution.
I figured it out. In case anyone else is looking for this here you go:
CALCULATE(
[Total Charge's],
SAMEPERIODLASTYEAR(
DATESMTD('DatesforPivot_PostedDt'[Date])
),
FILTER(
ALL(DatesforPivot_PostedDt),
DatesforPivot_PostedDt[MonthOfYear] <= (MONTH(NOW())-1)
)
)+
CALCULATE(
[Total Charge's],
SAMEPERIODLASTYEAR(
DATESMTD('DatesforPivot_PostedDt'[Date])
),
FILTER(
ALL(DatesforPivot_PostedDt),
DatesforPivot_PostedDt[MonthOfYear] = MONTH(NOW())
&& 'DatesforPivot_PostedDt'[DayOfMonth] <= DAY(NOW())
)
)
one easy way is to filter the date < TODAY()
Charges SDLY UpToYesterday=
CALCULATE ( [Charges SDLY], FILTER('Date','Date'[Date]< TODAY()))
where [Charges SDLY] is the SAMEPERIODLASTYEAR measure
This formula is incorrect. It doesn't return the actual Same day last year, month to date numbers. It returns same day last year (minus 1 day) , year to date numbers.
I figured it out. In case anyone else is looking for this here you go:
CALCULATE(
[Total Charge's],
SAMEPERIODLASTYEAR(
DATESMTD('DatesforPivot_PostedDt'[Date])
),
FILTER(
ALL(DatesforPivot_PostedDt),
DatesforPivot_PostedDt[MonthOfYear] <= (MONTH(NOW())-1)
)
)+
CALCULATE(
[Total Charge's],
SAMEPERIODLASTYEAR(
DATESMTD('DatesforPivot_PostedDt'[Date])
),
FILTER(
ALL(DatesforPivot_PostedDt),
DatesforPivot_PostedDt[MonthOfYear] = MONTH(NOW())
&& 'DatesforPivot_PostedDt'[DayOfMonth] <= DAY(NOW())
)
)
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
111 | |
100 | |
80 | |
64 | |
58 |
User | Count |
---|---|
148 | |
111 | |
93 | |
84 | |
66 |