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
SErgey-kuznetso
Frequent Visitor

cumulative total in order

Hello everyone! I need to calculate a cumulative total column. But the calculation should take place within each client's email in order of their index from smaller to larger. I have looked at other solutions on this topic, but they don't work for me because they calculate the total sum for the client. Is there a way to create a calculated column so that it adds up all the commissions for the client in order of the index?

 

I have a such data

 

Table 1:

emailclientperiod_(30_days)commissionindx
test@test.com03001
test@test.com24052172
test@test.com2703253
test@test.com36034344
test@test.com51036085
test@test.com5403746
test01@test.com05631
test01@test.com309262
test01@test.com2104503
test01@test.com6908654
test01@test.com7203205

 

As a result, I should get a column like this "cumulative_commission"

 

Table 2:

emailclientperiod_(30_days)commissionindxcumulative_commission
test@test.com03001300
test@test.com240521725517
test@test.com27032535842
test@test.com360343449276
test@test.com5103608512884
test@test.com540374613258
test01@test.com05631563
test01@test.com3092621489
test01@test.com21045031939
test01@test.com69086542804
test01@test.com72032053124

 

1 ACCEPTED SOLUTION
FreemanZ
Super User
Super User

hi @SErgey-kuznetso 

try to add a column like this:

cumulative_commission2 = 
VAR _client = [emailclient]
VAR _index = [index]
RETURN
SUMX(
    FILTER(
        TableName,
        TableName[emailclient] =_client
            &&TableName[index]<=_index
    ),    
    TableName[commission]
)

FreemanZ_0-1675158041830.png

View solution in original post

2 REPLIES 2
tamerj1
Super User
Super User

Hi @SErgey-kuznetso 

please try

cumulative_commission =
SUMX (
FILTER (
CALCULATETABLE ( 'Table', ALLEXCEPT ( 'Table', 'Table'[emailclient] ) ),
'Table'[index] <= EARLIER ( 'Table'[index] )
),
'Table'[commission]
)

FreemanZ
Super User
Super User

hi @SErgey-kuznetso 

try to add a column like this:

cumulative_commission2 = 
VAR _client = [emailclient]
VAR _index = [index]
RETURN
SUMX(
    FILTER(
        TableName,
        TableName[emailclient] =_client
            &&TableName[index]<=_index
    ),    
    TableName[commission]
)

FreemanZ_0-1675158041830.png

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