cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Regular Visitor

MAT/Rolling annual in DAX start calculating when it makes sense

Hello,

 

I've a question hopefully somebody can help me out.

 

I have a table with units per month of the last 24 months. (see table below)

I want to calculate the MAT in DAX and I use the following DAX below

 

CALCULATE(SUM(Table_1[Units]);DATESINPERIOD(Date_table[Date];LASTDATE(date_table[Date]);-12;MONTH))
 
The formula above is calculating the MAT, but the issue I'm having is the following:
For me MAT or rolling annual is only valid when it has 12 months. But I've only a set of 24 months back, I want that the formula is starting from month 12 (so feb-2019) (the green part of the table). Because that's the first month that is really MAT.
 
 
Probably the solution is easy, but I can't find it.....
 

 

Table.JPG

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Microsoft
Microsoft

Re: MAT/Rolling annual in DAX start calculating when it makes sense

Hi, @PMV 

If help ,change your measure as below:

measure = 
var measure1=CALCULATE(SUM(Table_1[Units]),DATESINPERIOD(Date_table[Date],LASTDATE(date_table[Date]),-12,MONTH))
return IF(DATEDIFF(CALCULATE(MIN('Table_1'[Date]),ALLSELECTED('Table_1')),MIN('Table_1'[Date]),MONTH)>=12,measure1)

It will show as below.

56.png

Pbix attached

 

If it still unsolved ,please share me your PBIX/some sample data and expected result.

Best Regards,
Community Support Team _ Eason
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

1 REPLY 1
Highlighted
Microsoft
Microsoft

Re: MAT/Rolling annual in DAX start calculating when it makes sense

Hi, @PMV 

If help ,change your measure as below:

measure = 
var measure1=CALCULATE(SUM(Table_1[Units]),DATESINPERIOD(Date_table[Date],LASTDATE(date_table[Date]),-12,MONTH))
return IF(DATEDIFF(CALCULATE(MIN('Table_1'[Date]),ALLSELECTED('Table_1')),MIN('Table_1'[Date]),MONTH)>=12,measure1)

It will show as below.

56.png

Pbix attached

 

If it still unsolved ,please share me your PBIX/some sample data and expected result.

Best Regards,
Community Support Team _ Eason
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

Helpful resources

Announcements
Community Blog

Community Blog

Visit our Community Blog for articles, guides, and information created by fellow community members.

Using the Community

Using the Community

Need help with the Power BI Community? Our 'Using the Community' support articles are a great place to start.

Community Summit North America

Community Summit North America

Innovate, Collaborate, Grow. The top training and networking event across the globe for Microsoft Business Applications

Power Platform 2020 release wave 2 plan

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors