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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

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
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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