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

Need help for MAT calculation in Power BI

Hi Everyone,

 

I got stuck to calculate MAT (Moving Annual Total) Sales in my report, please help me on the same

 

Data Scenario: Have Fact table (has only Quarterly aggregated sales values) and Aggregation table, either I need to acheive Solution 1 or Solution 2 which is given below

 

I have created a bridge table with distinct Year Quarter (which is the only join column between fact and Aggregator table)

 

Data Example:

 

Fact Table
Year Quarter Product Code Product Name Sales
20191 ABC ABC Parcel 500
20192 ABC ABC Parcel 750
20193 ABC ABC Parcel 250
20194 ABC ABC Parcel 2000
20194 XYZ XYZ Company 350
20201 XYZ XYZ Company 450
20202 XYZ XYZ Company 1250
20203 XYZ XYZ Company 250

 

Aggregator Table
Year Quarter Quarter Aggregator Aggregation Type
20194 20191 MAT
20194 20192 MAT
20194 20193 MAT
20194 20194 MAT
20194 20194 QTD
20203 20194 MAT
20203 20201 MAT
20203 20202 MAT
20203 20203 MAT
20203 20203 QTD

 

Expected Solution 1: 

Year Quarter Product Code Product Name Aggregation Type Sales
20194 ABC ABC Parcel QTD 2000
20194 ABC ABC Parcel MAT 3500
20203 XYZ XYZ Company QTD 250
20203 XYZ XYZ Company MAT 2300

 

Expected Solution 2:

Year Quarter Product Code Product Name Aggregation Type QTD Sales MAT Sales
20194 ABC ABC Parcel QTD 2000 3500
20203 XYZ XYZ Company QTD 250 2300

 

 

 

 

1 REPLY 1
v-stephen-msft
Community Support
Community Support

Hi @Dineshraj03 ,

 

What is the relationship between these two columns and why are there two columns of year and quarter?

6.png

 

 

Best Regards,

Stephen Tao

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

November Power BI Update 768x460.png

Check it Out!

Click here to read more about the November 2021 Updates!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.