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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
Composed_MS
Helper I
Helper I

Need Trended Chart for MAT calculation in Power BI

I need to form a trended chart of last 12 months depending on the slicer selection from the user, for one of the MAT calculation. MAT calculation looks like below, here I am using Calendar2 table to find out MAT sum according to month selection, suppose if I have selected Nov 2022 in month slicer(of Calendar table) then it will give me Dec 2021 to Nov 2022 in Calendar2 table. Connection between Calendar and Calendar2 table is inactive ->
var a=MAX(Calendar[Date])

var preious_dates=DATESINPERIOD(Calendar2[Date],a,-12,MONTH)


var Ours=CALCULATE(SUM(Market_Share_Brands[value]),Market_Share_Brands[manufacturer]="Ours",Market_Share_Brands[channels]="D - Commerce",REMOVEFILTERS('Calendar'),
KEEPFILTERS(preious_dates),USERELATIONSHIP('Calendar'[Date],Calendar2[Date]))

var Others=CALCULATE(SUM(Market_Share_Brands[Value]),Market_Share_Brands[Manufacturer]<>"Ours",Market_Share_Brands[Channels]="D - Commerce",REMOVEFILTERS('Calendar'),
KEEPFILTERS(preious_dates),USERELATIONSHIP('Calendar'[Date],Calendar2[Date]))

return DIVIDE(Ours,(Others+Ours))

So this thing is working fine if I want to show particular month's MAT value, but if I need to show trended chart for last 12 months then it filters out the month that is being selected and not the last 12 months. What should I do to get last 12 month's MAT numbers in trended chart?

1 REPLY 1
lbendlin
Super User
Super User

Please provide sample data that covers your issue or question completely.
https://community.powerbi.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-Forum/ba-...
Please show the expected outcome based on the sample data you provided.

https://community.powerbi.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.