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

Moving sum last 12 month

last 12 month.PNG
hii
I want to find last 12 month sum from selected month if i am in Dec -17 then last 12 month person count (count of personnel number) again same for nov-17 is selected then that month and last 12 month count of personnel number count sum like wise .......

1 ACCEPTED SOLUTION
Anonymous
Not applicable

For this to work, you need a SERIAL ID column for the months in your calendar table.

 

A serial ID will start at 1, but will increase by 1 for each month, and NOT reset after 12.

 

For example, if your calendar starts in January 2016, then that month ID = 1.  January 2017's month ID = 13.

 

Assuming that column exists in your calendar table, (and the column is called [MonthID]), this is the formula:

 

Measure =
CALCULATE (
    SUM ( TableName[ColumnName] ),
    FILTER (
        ALL ( Calendar ),
        Calendar[MonthID] <= MAX ( Calendar[MonthID] )
            && Calendar[MonthID]
                >= MAX ( Calendar[MonthID] ) - 11
    )
)

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

For this to work, you need a SERIAL ID column for the months in your calendar table.

 

A serial ID will start at 1, but will increase by 1 for each month, and NOT reset after 12.

 

For example, if your calendar starts in January 2016, then that month ID = 1.  January 2017's month ID = 13.

 

Assuming that column exists in your calendar table, (and the column is called [MonthID]), this is the formula:

 

Measure =
CALCULATE (
    SUM ( TableName[ColumnName] ),
    FILTER (
        ALL ( Calendar ),
        Calendar[MonthID] <= MAX ( Calendar[MonthID] )
            && Calendar[MonthID]
                >= MAX ( Calendar[MonthID] ) - 11
    )
)
Anonymous
Not applicable

@Anonymous thank you this works very well....

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.