Forum Discussion
leolapa_br
Resolver II
2 years agoSummary table from VAR temporary table
I have produced the following VAR (temporary) table called 'Tabela_CP_DiasxValor_DiasPeso_Dias' with 300+ rows: What I need is to come up with another VAR table that basically summarizes the v...
- 2 years ago
leolapa_br Use GROUPBY with SUMX( CURRENTGROUP(), [@Days] )
- 2 years ago
GROUPBY is cleaner but another option would be to filter Tabela inside the SUMX.
VAR Tabela_CP_DiasporForn = ADDCOLUMNS ( SUMMARIZE ( Tabela_CP_DiasxValor_DiasPeso_Dias, [Código - Nome do fornecedor] ), "@DiasSoma", VAR _Codigo = [Código - Nome do fornecedor] RETURN SUMX ( FILTER ( Tabela_CP_DiasxValor_DiasPeso_Dias, [Código - Nome do fornecedor] = _Codigo ), [@Dias] ) )
Greg_Deckler
Community Champion
2 years agoleolapa_br Use GROUPBY with SUMX( CURRENTGROUP(), [@Days] )
AlexisOlson
Super User
2 years agoGROUPBY is cleaner but another option would be to filter Tabela inside the SUMX.
VAR Tabela_CP_DiasporForn =
ADDCOLUMNS (
SUMMARIZE ( Tabela_CP_DiasxValor_DiasPeso_Dias, [Código - Nome do fornecedor] ),
"@DiasSoma",
VAR _Codigo = [Código - Nome do fornecedor]
RETURN
SUMX (
FILTER (
Tabela_CP_DiasxValor_DiasPeso_Dias,
[Código - Nome do fornecedor] = _Codigo
),
[@Dias]
)
)