Forum Discussion
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 "
Anyone knows how to replicate this in DAX?
Thank you in advance!
4 Replies
- Greg_DecklerCommunity Champion
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.
- AnonymousNot 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.
- v-yulgu-msftMicrosoft 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
- v-yulgu-msftMicrosoft 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