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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
ghanta
New Member

Sum of values from same column but based on multiple columns

Hi,
I am trying to calculate TTM for count  for each row in the following case and I am not sure what formula should I use

CountYearQtrYearQtr-1YearQtr-2YearQtr-3TTM
1002022-Q42022-Q32022-Q22022-Q1

1000

2002022-Q32022-Q22022-Q12021-Q4 1400
3002022-Q22022-Q12021-Q42021-Q3 1800
4002022-Q12021-Q42021-Q32021-Q2 
5002021-Q42021-Q32021-Q22021-Q1 
6002021-Q32021-Q22021-Q12020-Q4 
1 ACCEPTED SOLUTION
FreemanZ
Super User
Super User

Hi @ghanta 

 

try to add a column with this:

TTM2 = 
VAR _a=[YearQtr]
VAR _b=[YearQtr-1]
VAR _c=[YearQtr-2]
VAR _d=[YearQtr-3]
RETURN
SUMX(
    FILTER(
        TableName,
        TableName[YearQtr] IN {_a, _b, _c, _d}
    ),
    TableName[Count]
)

 

i tried and it worked like this:

FreemanZ_0-1671242322977.png

View solution in original post

1 REPLY 1
FreemanZ
Super User
Super User

Hi @ghanta 

 

try to add a column with this:

TTM2 = 
VAR _a=[YearQtr]
VAR _b=[YearQtr-1]
VAR _c=[YearQtr-2]
VAR _d=[YearQtr-3]
RETURN
SUMX(
    FILTER(
        TableName,
        TableName[YearQtr] IN {_a, _b, _c, _d}
    ),
    TableName[Count]
)

 

i tried and it worked like this:

FreemanZ_0-1671242322977.png

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

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.

Top Solution Authors