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
Anonymous
Not applicable

SUM VALUES BASED ON A DISTINCT VALUE ON ANOTHER COLUMN

Hi all, 

 

I am sure you guys already resolved similar questions. 

 

I am looking at the following table (this is just a sample). I want to SUM the Rate_VS_Tipo and DISTINCT by Processo_SGC. 

What I want to achieve is get the SUM of the Rate, for each Processo_SGC where Processo_SGC must be a unique SUM. Meaning, in the below example the result would be 25,9. I am only getting the sum of all of them. Cheers

 
1.JPG

This isnt working: 
Preço (€) Distinct =
CALCULATE(SUM(t_Detalhe_Processos_Fases_Tarefas[Rate_VS_Tipo]);
FILTER (DISTINCT(
't_Detalhe_Processos_Fases_Tarefas');
't_Detalhe_Processos_Fases_Tarefas'[Rate_VS_Tipo]
)
)
1 ACCEPTED SOLUTION

Hi @Anonymous

Try this measure

Measure =
CALCULATE (
    SUM ( Sheet2[col2] ),
    FILTER (
        DISTINCT ( Sheet2 ),
        [col1] = MAX ( [col1] )
            && Sheet2[Tipo_Processo_SGC] IN { "INC1", "INC2" }
    )
)

If it doesn't work, please share the screenshot when you apply this measure in the table

 

Best Regards

Maggie

 
 

View solution in original post

5 REPLIES 5
v-juanli-msft
Community Support
Community Support

Hi @Anonymous

you create a column as below, right?

5.png

 

I create a measure as above, is this what you want?

Measure = CALCULATE(SUM(Sheet2[col2]),FILTER(DISTINCT(Sheet2),[col1]=MAX([col1])))

If not, please let me know your expected result based on my example.

 

Best Regards

Maggie

 

Anonymous
Not applicable

Hi Maggie, 

 

Thank you so much!! I think that we got to the result, yes! 

Now, I'd like to add this filter, can you plesase let me know how I could possibly do this: 

FILTER (
't_Detalhe_Processos_Fases_Tarefas';
't_Detalhe_Processos_Fases_Tarefas'[Tipo_Processo_SGC]
IN {"INC1";"INC2"}
)
 

Hi @Anonymous

Try this measure

Measure =
CALCULATE (
    SUM ( Sheet2[col2] ),
    FILTER (
        DISTINCT ( Sheet2 ),
        [col1] = MAX ( [col1] )
            && Sheet2[Tipo_Processo_SGC] IN { "INC1", "INC2" }
    )
)

If it doesn't work, please share the screenshot when you apply this measure in the table

 

Best Regards

Maggie

 
 
Anonymous
Not applicable

Fantastic! 

Thank you very much. 

 

Anonymous
Not applicable

+++ And then I would like to filter it as well. 

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.