Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more.
Get startedGrow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.
I'm using the following Last MTD Costs formula to show a floating cost total in a card. It's showing BLANK.
Last MTD Costs = CALCULATE(SUM('Usage Details - 2'[Cost]),PREVIOUSMONTH(dateDimension[Date]))
I have a similar formula for Last YTD total which is working. No interaction is set with other filters.
Any ideas?
Try like
MTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD('Date'[Date]))
last MTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD(dateadd('Date'[Date],-1,MONTH)))
last MTD (complete) Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD(ENDOFMONTH(dateadd('Date'[Date],-1,MONTH))))
last year MTD (complete) Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD(ENDOFMONTH(dateadd('Date'[Date],-12,MONTH))))
last year MTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD(dateadd('Date'[Date],-12,MONTH)))
last QTR same Month (complete) Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD(ENDOFMONTH(dateadd('Date'[Date],-1,Qtr))))
MTD (Year End) Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD(ENDOFYEAR('Date'[Date])))
MTD (Last Year End) Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD(ENDOFYEAR(dateadd('Date'[Date],-12,MONTH),"8/31")))
.
I tried using the formula:
last MTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD(dateadd('Date'[Date],-1,MONTH)))
It's still showing as BLANK.
Are you getting data for MTD. Have you selected any date or not. If you have not selected any date the MTD will start from the last month of the calendar.
That makes sense!
I want it to be dynamic. How would I accomplish that? Incorporating the TODAY function?
Hi @anelliaf ,
Do you try the way that amitchandak suggested? Have you resolved the problem? If yes, please accept the helpful answer as a solution. If you still need help, can you please share a dummy file? Then we will understand clearly about your situation.
I will be trying to apply his suggestion today. I'll update the post after doing so.
There are a few ways.
1. Stop your calendar till today
2. Have a visual or page level filter on a date. Use relative option filter <= today. And MTD has its own time. Just today is also enough
My formula doesn't appear to be working:
Hi @anelliaf ,
Can you please share a few screenshots and sample data?
Here is a screenshot of the formula:
Here's a screenshot of the relationship:
Here's some more formulas I'm trying:
Last Month Sum = VAR endDate = LASTDATE(dateDimension[MonthDate])
RETURN
CALCULATE(
SUM('Usage Details - 2'[Cost]),
dateDimension[MonthDate] = endDate
...with MonthDate as the following:
MonthDate = DATE(YEAR(dateDimension[Date]), MONTH(dateDimension[Date]), 1)
Unsure why it seems so complicated to have a dynamic value for last months total. It works when they're associated with the slicers/filters. However, once I edit interactions I recieve the '(BLANK)' value.
Hi @anelliaf ,
Maybe you could have a try like this:
Last MTD Costs =
VAR vLastMTD =
FORMAT (
CALCULATE (
SUM ( 'Table'[Sales] ),
DATEADD ( DATESMTD ( 'Date'[Date] ), -1, MONTH )
),
"$0.00"
)
RETURN
MAXX ( 'Table', vLastMTD )
Best Regards,
Xue Ding
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi Xue,
I think I worded my post wrong. I'm looking for a floating visual card showing last month's total costs, not last month to current date.
In other words, I'm trying to show a dynamic visual where last month would be February costs, since we're in March. Once we go into April, I'd like for the visual to dynamically change to show March costs since we'd be in April.
Thanks,
Frank
Hi @anelliaf ,
In my sample, it is shown the value of the last month ( February's costs not contain March's) in Card visual. And in April, the data will be updated after refreshing. The value is not static.
Maybe I don't understand what you what clearly. Can you please share some sample data and the correct output?
I'm not sure, but it showed blank in my report.
User | Count |
---|---|
88 | |
88 | |
74 | |
68 | |
57 |
User | Count |
---|---|
136 | |
110 | |
91 | |
84 | |
69 |