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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
renanc
Helper II
Helper II

Calculate the sum within a a value in another column

Good afternoon everybody.

I would lilke to calculate the sum of the values in the column Valores_Preparacao, but only for the same plate. So for the rows with the plate ABL5H38, for example, I would like to have the sum only of that value, the same for ABL6J21, and so on.
Ps: For both these plates, the sum is the same, but is just a concidence, for the majority of the plates, the sum will be different.

Thanks in advance for any help.

01.jpg

2 ACCEPTED SOLUTIONS
Jihwan_Kim
Super User
Super User

Hi,

Please check the below picture and the attached pbix file.

I tried to create a sample pbix file like below.

It is for creating a calculated column.

 

Untitled.png

 

Valor Somado CC =
SUMX (
    FILTER ( Data, Data[Coluna] = EARLIER ( Data[Coluna] ) ),
    Data[Valores_Preparacao]
)

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Visit my LinkedIn page by clicking here.


Schedule a meeting with me to discuss further by clicking here.

View solution in original post

Hi,

Please try the below calculated column.

 

Valor_Somado CC =
SUMX (
    FILTER (
        'tablename',
        'tablename'[coluna] = EARLIER ( 'tablename'[coluna] )
            && 'tablename'[dtcadastro] = EARLIER ( 'tablename'[dtcadastro] )
    ),
    'tablename'[valorespreparacao]
)

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Visit my LinkedIn page by clicking here.


Schedule a meeting with me to discuss further by clicking here.

View solution in original post

4 REPLIES 4
renanc
Helper II
Helper II

@Jihwan_Kim I have one more question, if you can help me, please
I just realized that there are some cases when the same car (the same value in the column Coluna) did different checklists, in different dates, and I have to Group By Coluna and DtCadastro (the Date of The Checklist).
I tried but the Dax return the message: Muitos argumentos foram passados para a função FILTER. Contagem máxima de argumentos para a função: 2. - Many Arguments were passed to Filter function. In the second image we can see that the plate ABL3F70 has some different values in the columns DtCadastro, so I would like to Group by the values of DtCadastro, in addition to Coluna.

renanc_0-1653404374006.png

renanc_1-1653404436942.png

 

 

Hi,

Please try the below calculated column.

 

Valor_Somado CC =
SUMX (
    FILTER (
        'tablename',
        'tablename'[coluna] = EARLIER ( 'tablename'[coluna] )
            && 'tablename'[dtcadastro] = EARLIER ( 'tablename'[dtcadastro] )
    ),
    'tablename'[valorespreparacao]
)

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Visit my LinkedIn page by clicking here.


Schedule a meeting with me to discuss further by clicking here.

renanc
Helper II
Helper II

Thanks @Jihwan_Kim, it worked!

Jihwan_Kim
Super User
Super User

Hi,

Please check the below picture and the attached pbix file.

I tried to create a sample pbix file like below.

It is for creating a calculated column.

 

Untitled.png

 

Valor Somado CC =
SUMX (
    FILTER ( Data, Data[Coluna] = EARLIER ( Data[Coluna] ) ),
    Data[Valores_Preparacao]
)

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Visit my LinkedIn page by clicking here.


Schedule a meeting with me to discuss further by clicking here.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.