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
snaraya
Helper II
Helper II

Sum previous months result to next month for each year

Hi everyone,

 

I want to sum result column monthly and divide it by 12, and which resets yearly

such as Jan 2021 =jan sum_result 2021 /12

Feb=( jan+feb)/12 and so on for each month and each BU

 

and when it starts 2022 it should start again as 

Jan 2022=jan sum_result 2022/12

Feb 2022 =( jan+feb)/12 and so on for each month and each BU

 

 

I was not able to do this directly so i thought to create new measure Divide= [Sum_result]/12 and just do cumulative sum monthly for each year of a measure but couldnt do that too

 

result is a column where sum fuction is used in fields pane,

 

i dont have a date column but i have a month and year column so i created a date column using that where every date is 1st of each month 

 

Date = FORMAT('Table'[Month] &"-"& 'Table'[Reporting Period],"MM-YYYY") and changed it into date format

 

using this i created a date table : calender = CALENDAR(MIN('Table'[Date]),MAX('Table'[Date])) and then linked relationship between two tables

 

Below is the data 

i tried to create a new measure called cumulative with below fomula so that it just do a cumulative sum but it gave me same answer as divide column

 

Test = CALCULATE(SUMX('Table',[Divide]),FILTER(ALLSELECTED(calender[Date]),calender[Date]<=MAX(calender[Date])))

 
can someone guide what needs to be done exactly ..i tried multiple things

 

Reporting PeriodMonth_numberNew BUresultDivideCumulativeRequired output
20211A2949245.75245.75245.75
20212A2988249249494.75
20213A2990249.1667249.1667743.9167
20214A2989249.0833249.0833993
20215A2989249.0833249.08331242.083
20216A2989249.0833249.08331491.167
20217A2979248.25248.251739.417
20218A3003250.25250.251989.667
20219A3003250.25250.252239.917
202110A3003250.25250.252490.167
202111A3003250.25250.252740.417
202112A3003250.25250.252990.667
20221A3113259.4167259.4167259.4167
20222A3113259.4167259.4167518.8333
20223A3113259.4167259.4167778.25
20224A3109259.0833259.08331037.333
20225A3109259.0833259.08331296.417
20226A3110259.1667259.16671555.583
20227A3110259.1667259.16671814.75
20228A3110259.1667259.16672073.917
20229A3110259.1667259.16672333.083
202210A3215267.9167267.91672601
202211A3290274.1667274.16672875.167
202212A3292274.3333274.33333149.5
20231A3499291.5833291.5833291.5833
20232A3362280.1667280.1667571.75
20233A3353279.4167279.4167851.1667

 

any help appreciated

 

1 ACCEPTED SOLUTION
Mahesh0016
Super User
Super User

@snaraya 

Mahesh0016_0-1683032750036.pngMahesh0016_1-1683032771918.png

Cumulative =
CALCULATE (
    [Total Result],
    FILTER ( ALL ( 'Sum'[Month_number] ), 'Sum'[Month_number] <= MAX ( 'Sum'[Month_number] ) )
)
###########################################
Required output = DIVIDE([Cumulative],12,0)
###########################################
Total Result = SUM('Sum'[result])


Thank You!!

View solution in original post

2 REPLIES 2
Mahesh0016
Super User
Super User

@snaraya 

Mahesh0016_0-1683032750036.pngMahesh0016_1-1683032771918.png

Cumulative =
CALCULATE (
    [Total Result],
    FILTER ( ALL ( 'Sum'[Month_number] ), 'Sum'[Month_number] <= MAX ( 'Sum'[Month_number] ) )
)
###########################################
Required output = DIVIDE([Cumulative],12,0)
###########################################
Total Result = SUM('Sum'[result])


Thank You!!

Thankyou so much for this..Saved me!!😊

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.

Top Solution Authors