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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register 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
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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