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

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
v-yulgu-msft
Employee
Employee

Hi @Anonymous ,

 

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.
v-yulgu-msft
Employee
Employee

Hi @Anonymous,

 

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.
Greg_Deckler
Super User
Super User

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.


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

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

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.