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

Did you hear? There's a new SQL AI Developer certification (DP-800). Start preparing now and be one of the first to get certified. Register now

Reply
PERMATA
Frequent Visitor

MAT & MAT Prior has same value using SAMEPERIODLASTYEAR

Hi Expert 

 

I am still learning in DAX and trying to calculate MAT, PYMAT

this is the formula I use

 

MAT = CALCULATE(
AVERAGE(data[value]),
DATESINPERIOD('Date'[Date],LASTDATE('Date'[Date]),-1,YEAR)
)

pMAT = CALCULATE([MAT],SAMEPERIODLASTYEAR('Date'[Date].[Date]))

 

 
but somehow it produces the same value 😞 please help with this
I have tried to search in this community but the solution is still producing the same value
 
Thank you 
 

 

 

 
7 REPLIES 7
PERMATA
Frequent Visitor

Hi @amitchandak , I found the MAT and MAT Prior show the same value when it aggregated (right side)

but show the correct figure when it show at month/year level (left side)

 

how to make the formula also work for aggregated (left side)?

question.PNG

 

Thank you 🙂

Anonymous
Not applicable

Hi @PERMATA ,

Could you please provide your pbix file with the latest version? Later will check it and give you a suitable soltuion. Thank you. 

Best Regards

Hi @Anonymous 

 

I upload the .pbix here https://drive.google.com/drive/folders/1XmREz69UM0m31gVIPy-9BvGnnGEIDMXd

 

Thank you

 

 

Anonymous
Not applicable

Hi @PERMATA ,

It seems that I don't have the proper access to your shard file. Could you please grant me the proper access? Thank you.

Best Regards

Hi @Anonymous 

Please find the .pbix here 🙂

https://drive.google.com/drive/folders/1XmREz69UM0m31gVIPy-9BvGnnGEIDMXd 

 

thank you

amitchandak
Super User
Super User

@PERMATA , You should use .[Date], Make sure date table is marked as date table

 

Try the second one like

 

MAT =

Var _date  =LASTDATE('Date'[Date])

var _dt = date(year(_date)-1, month(_date), Day(_date))

return

CALCULATE(
AVERAGE(data[value]),
DATESINPERIOD('Date'[Date],_date  ,-1,YEAR)
)

Why Time Intelligence Fails - Powerbi 5 Savior Steps for TI :https://youtu.be/OBf0rjpp5Hw
https://amitchandak.medium.com/power-bi-5-key-points-to-make-time-intelligence-successful-bd52912a5b...
To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s. Refer :radacad sqlbi My Video Series Appreciate your Kudos.

 

 

If this does not help
Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Hi Amitchandak,

 

thank you for answering, I have put a new formula you've suggest but it still show the same figure with previousMAT (pMAT = CALCULATE([MAT],SAMEPERIODLASTYEAR('Date'[Date].[Date])))

 

You may find the .pbix here

https://drive.google.com/file/d/1jHSEXdpRrTSGshrQuX4cTsPHks0IIUYc/view?usp=sharing 

 

Thank you

 

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

Check out the April 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.