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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Rolling 12 months in table visualisation

Hi Team,

 

I have raw data like below table :- 

CaseIdNameStaffLine of ServiceViolation HistoryFine AmountDate
11ShubhamPartnerABCMatter Type A…650Jan
12ShubhamPartnerABCMatter Type A…650Feb
13ShubhamPartnerABCMatter Type A…700March
14ShubhamPartnerABCMatter Type B…0Jan
15ShubhamPartnerABCMatter Type B…0Feb
16ShubhamPartnerABCMatter Type C…500Jan
17FayazManagerPQRMatter Type A…650Jan
18FayazManagerPQRMatter Type A…650Feb
19FayazManagerPQRMatter Type A…700March
20FayazManagerPQRMatter Type B…0Jan
21FayazManagerPQRMatter Type B…0Feb
22FayazManagerPQRMatter Type C…500Jan

 

 

 

and I wanted to create rolling 12 months output like below table :- 

 

 

NameStaffLine of ServiceViolation HistoryCount of CasesTotal Amount
ShubhamPartnerABCMatter Type A…33000
   Matter Type B…20
   Matter Type C…1500
SubTotal    3500
FayazPartnerPQRMatter Type A…33000
   Matter Type B…200
   Matter Type C…1500
SubTotal    3500

 

Could you please help me on this ?

 

Thanks,

Shubham

2 REPLIES 2
v-zhenbw-msft
Community Support
Community Support

Hi @Anonymous ,

 

You need to have a date column to roll. We can use the following steps to meet your requirement.

 

1. Create a date table that doesn’t contain relationship.

 

date = 
ADDCOLUMNS(CALENDAR("2020/1/1","2020/12/31"),"month name",FORMAT([Date],"mmm"),"month number",MONTH([Date]))

 

Rolling 1.jpg

 

2. Create two measures,

 

Count = 
var selected_ = MIN('date'[Date])
var selected_12 = DATE(YEAR(selected_)-1,MONTH(selected_),DAY(selected_))
return
CALCULATE(COUNT('Table'[Violation History]),FILTER('Table','Table'[Date]<=selected_ && 'Table'[Date]>=selected_12))

 

Total Amount = 
var selected_ = MIN('date'[Date])
var selected_12 = DATE(YEAR(selected_)-1,MONTH(selected_),DAY(selected_))
return
CALCULATE(SUM('Table'[Fine Amount]),FILTER('Table','Table'[Date]<=selected_ && 'Table'[Date]>=selected_12))

 

3. Then we can create a matrix table,

 

Rolling 2.jpg

 

Turn off the stepped layout,

 

rolling 3.jpg

 

And in the subtotal, we can configure it as screenshot.

 

rolling 4.jpg

 

4. At last, we can add a slicer based on date table, the result like this,

 

rolling 5.jpg

 

If it doesn’t meet your requirement, could you please show the exact expected result based on the table that you have shared?

BTW, pbix as attached.

 

Best regards,

 

Community Support Team _ zhenbw

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

Anonymous
Not applicable

@v-zhenbw-msft Thank you so much for your solution. It was really helpful 🙂 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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