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

The FabCon + SQLCon recap series starts April 14th at 8am Pacific. If you’re tracking where AI is going inside Fabric, this first session is a can't miss. Register now

Reply
leolapa_br
Resolver II
Resolver II

Summary table from VAR temporary table

I have produced the following VAR (temporary) table called 'Tabela_CP_DiasxValor_DiasPeso_Dias' with 300+ rows:

VAR_Table.png

What I need is to come up with another VAR table that basically summarizes the vendors column highlighted to the left and group them so I get on a second column the total of "@Dias" highlighted to the right for each vendor.

 

I tried doing that with the following code:

 

VAR Tabela_CP_DiasporForn = 
	SUMMARIZE(
		Tabela_CP_DiasxValor_DiasPeso_Dias,
		[Código - Nome do fornecedor],
		"@DiasSoma", SUMX(Tabela_CP_DiasxValor_DiasPeso_Dias, [@Dias])
	)

 

But what I end up getting is the summarized table (100+ rows, which is correct) but with the overall total of "@Dias" instead of the total by row/vendor:

Summ_Table.png

I tried going with SUM instead of SUMX but DAX won't take the [@Days] column since it comes from the previous VAR table, and CALCULATE produces the same outcome.

 

How can I get that done? Any help is appreciated!

2 ACCEPTED SOLUTIONS
Greg_Deckler
Community Champion
Community Champion

@leolapa_br Use GROUPBY with SUMX( CURRENTGROUP(), [@Days] )



Follow on LinkedIn
@ 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!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

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]
            )
)

 

View solution in original post

2 REPLIES 2
Greg_Deckler
Community Champion
Community Champion

@leolapa_br Use GROUPBY with SUMX( CURRENTGROUP(), [@Days] )



Follow on LinkedIn
@ 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!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

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]
            )
)

 

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.