Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
BIsteht
Helper III
Helper III

Previous Month to Date returning blank value

I need to calculate previous mtd, ytd, & week to date for use in KPI visuals.The below focuses on MTD. I have Sales and DImDate tables connected in the model. Sales[Date] is connected to DimDate[Date]. DimDate table contains consecutive values. The formulas below were found in forums, but both return (Blank).

 

Stack Overflow

 

Total Revenue MTD Last Month = TOTALMTD(SUM(SalesTable[revenue]),DATEADD(FILTER(DATESMTD(DimDate[Date]),DimDate[Date]<TODAY()),-1,MONTH))

 

MSDN post 

Revenue Prior MTD:=CALCULATE([Total Revenue],DATEADD(DATESMTD(DimDate[Date]),-1,MONTH)

 

Any ideas why I am getting a blank here? I don't find that anyone else has run into this issue in the posts linked above.

 

 

 

1 ACCEPTED SOLUTION

@BIsteht,

 

For any time intelligence function, you could implement a custom DAX formula.

https://www.sqlbi.com/articles/time-intelligence-in-power-bi-desktop/

Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

6 REPLIES 6
anandav
Skilled Sharer
Skilled Sharer

Hi @BIsteht,

 

Check this blog. When you understand the blog you can use the below DAX.

 

Total MTD =
TOTALMTD(SUM(PrevMonth[Amount]),
    DATESINPERIOD(MyDates[Date],
        LASTDATE(MyDates[Date]),
        SELECTEDVALUE(MyMonthsTable[Past Months], 0), 
        MONTH
    )
)

 

If you do not need the time intervalto be dynamic as explained in the blog, just replace SELECTEDVALUE(MyMonthsTable[Past Months], 0) with -1.

 

Hope this helps.

 

If this solves your problem please mark as solution.

@anandav Thanks for the quick response. Unfortunately this also results in blank.  My formula adpated from yours:

 

Total Revenue MTD Last Month = TOTALMTD(SUM(SQLQuery[revenue]),DATESINPERIOD(DimDate[Date],LASTDATE(DimDate[Date]),-1,MONTH))

 

Previous month.jpg

 

I feel like calculating Previous MTD, QTD, YTD should be much easier than I have made it out to be. Any additional thoughts? Again, thanks for the help.

Hi @BIsteht,

 

Are you trying to create a new column or measure?

If it is a measure it should work as explained in the blog.

 

Can you upload your Power BI .pbix file with sample data (not your actual production data) to a cloud drive and share the link?

 

 

 

I am adding a measure. Everything I have tried comes back with no result (blank). It will take me a couple days to obscure data and provide.

@BIsteht,

 

For any time intelligence function, you could implement a custom DAX formula.

https://www.sqlbi.com/articles/time-intelligence-in-power-bi-desktop/

Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

I have reviewed the referenced link and, after testing, it looks like the values are calculating correctly. The issue is that I cannot get the KPI visual set up to disaply properly. I will search and open a different topic if needed. Thanks for the help!

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors