cancel
Showing results for 
Search instead for 
Did you mean: 
Reply

Group By and Then Sum Values

Hi Community, 

 

I have an interesting challenge for us to discover. The following table has been built in a different BI platform. I am replicating into my Power BI Dashboard. Here's the challenge, the line headers are built based on a group of if statements that slice the type of data that each will consider. Here's the sample:  

 

"If(([Detalhe_Processos.Tipo_Processo_SGC]='EVE' OR [Detalhe_Processos.Tipo_Processo_SGC]='CMP' OR [Detalhe_Processos.Tipo_Processo_SGC]='FTR' OR [Detalhe_Processos.Tipo_Processo_SGC]='EXC'),'Evolutiva',

If(([Detalhe_Processos.Tipo_Processo_SGC]='TPS'),'Trabalhos Preparatórios', etc "

 

2.PNG

Anyone knows how to replicate this in DAX? 

 

Thank you in advance!  

 

 

 

4 REPLIES 4
Super User
Super User

Re: Group By and Then Sum Values

If I am understanding your need correctly, you would want to use the Detalhe_Processos.Tipo_Processo_SGC to create a Group. Then you would use that Group for your rows.


Did I answer your question? Mark my post as a solution!

Proud to be a Datanaut!


Community Support Team
Community Support Team

Re: Group By and Then Sum Values

Hi @nelson_marques,

 

In Power BI, you can still use above IF statement to create a calculated column in data table, then, add this new column into "Columns" of a Matrix visual, and place corresponding fields into "Rows" and "Values". "Values" will be sumed up based on row and column automatically.

 

Best regards,

Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Re: Group By and Then Sum Values

Exactly, there are multiple "Tipo_Processo_SGC", I would need to group them differently and then use them as dimension line in my table. 

Community Support Team
Community Support Team

Re: Group By and Then Sum Values

Hi @nelson_marques ,

 

Is "Detalhe_Processos.Tipo_Processo_SGC" a column name in source data table? If so, you could group this column by creating a calculated column:

 

Group =
IF (
    Detalhe_Processos[Tipo_Processo_SGC] = 'EVE'
        || Detalhe_Processos[Tipo_Processo_SGC] = 'CMP'
        || Detalhe_Processos[Tipo_Processo_SGC] = 'FTR'
        || Detalhe_Processos[Tipo_Processo_SGC] = 'EXC',
    "Evolutiva",
    IF (
        Detalhe_Processos[Tipo_Processo_SGC] = 'TPS',
        "Trabalhos Preparatórios",
        "Other"
    )
)

 

 

For more advice, please provide sample data in source table and show us your expected output as suggested in this link.

 

Best regards,

Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.