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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Anonymous
Not applicable

Rolling sum of sales for three years by colour

Hi, 

 

I would like to find a rolling sum for three years for every colour provided.


venice23_0-1675354238845.png

1 ACCEPTED SOLUTION
FreemanZ
Super User
Super User

hi @Anonymous 

try to plot a visual with year and colour columns, and a measure like:

 

3YColourSum = 
VAR _year = MAX(TableName[year])
RETURN
SUMX(
    FILTER(
        ALL(TableName),
        TableName[Colour] = MAX(TableName[Colour])
            &&TableName[Year] IN {_year, _year-1, _year-2}
    ), 
    TableName[Sales]
)

 

it worked like:

FreemanZ_0-1675662926487.png

 

 

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

@FreemanZ 
Thank you! It worked well.

Anonymous
Not applicable

Thank you! It worked well.

FreemanZ
Super User
Super User

hi @Anonymous 

try to plot a visual with year and colour columns, and a measure like:

 

3YColourSum = 
VAR _year = MAX(TableName[year])
RETURN
SUMX(
    FILTER(
        ALL(TableName),
        TableName[Colour] = MAX(TableName[Colour])
            &&TableName[Year] IN {_year, _year-1, _year-2}
    ), 
    TableName[Sales]
)

 

it worked like:

FreemanZ_0-1675662926487.png

 

 

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.