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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
6mon
Helper II
Helper II

Summarize ignores context

Can you help me understand the difference between 

 

SUMX(
    SUMMARIZE(
        FACT_COST_RESOURCE_CATEGORY;
        FACT_COST_RESOURCE_CATEGORY[ID_DIM_PROJECT];
        FACT_COST_RESOURCE_CATEGORY[ID_DIM_ACTIVITY];
        FACT_COST_RESOURCE_CATEGORY[ID_DIM_RESOURCE_CATEGORY];
        "COST PLANNED PROJECT";
        FIRSTNONBLANK(DIM_RESOURCE_CATEGORY[COST_EQUIPMENT_BUDGET];1)
        +
        FIRSTNONBLANK(DIM_RESOURCE_CATEGORY[COST_LABOR_BUDGET];1)
        +
        FIRSTNONBLANK(DIM_RESOURCE_CATEGORY[COST_UNIT_BUDGET];1)
    );
    [COST PLANNED PROJECT]
)

and

 

SUMX(
    SUMMARIZE(
        FACT_COST_RESOURCE_CATEGORY;
        FACT_COST_RESOURCE_CATEGORY[ID_DIM_PROJECT];
        FACT_COST_RESOURCE_CATEGORY[ID_DIM_ACTIVITY];
        FACT_COST_RESOURCE_CATEGORY[ID_DIM_RESOURCE_CATEGORY]
    );
    FIRSTNONBLANK(DIM_RESOURCE_CATEGORY[COST_EQUIPMENT_BUDGET];1)
    +
    FIRSTNONBLANK(DIM_RESOURCE_CATEGORY[COST_LABOR_BUDGET];1)
    +
    FIRSTNONBLANK(DIM_RESOURCE_CATEGORY[COST_UNIT_BUDGET];1)
)

?

 

From what I can observe the second one doesn't care for the context.

 

I'm trying to optimize the top one and altough the second one is much faster (yay!), the results are wrong...

2 REPLIES 2
Anonymous
Not applicable

Have you tried using GROUPBY, which then gives you access to row context using CURRENTGROUP()

 

So something like:

GROUPBY(
	TABLE TO GROUP,
	GROUP BY COLUMN,
	GROUP BY COLUMN,
	ETC,
	"Name of New Column",
	SUMX (
		CURRENTGROUP(),
		Expression 
	)
)

Generally dont want to add columns in summarize, better to use ADDCOLUMNS and SUMMARIZE.  

Thanks for the suggestion but FIRSTNONBLANK doesn't seem permitted in the GROUPBY functions...

 

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors