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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
ajimenez
Frequent Visitor

Bad behavior dax subtotal

i everyone,
I am trying to calculate the total for the field result of the following table:

YearQuarterLineTotal DaysAverage DaysTotal Items% EffectivenessResult
20163ACA12812810.056,4
20163HIL101650860.3152,4
20163INV1989994,5100.5497,25
20163TEJ52826430.1539,6
Grand Total  3661473,625201473,625

 

 

The right value I expect is 695.65.

But DAX is not adding the fields (6.4 + 152.4 + 497.25 + 39.6), instead it is multiplying the total fields Average Days (473,625) and [% Effectiveness] (1) .  I created the following Measures to perform this calculation:

Average Days = AVERAGE(Table[Total Days])
% Effectiveness = SUM(Table[Total Items]) / CALCULATE(SUM(Table[Total Items]),ALLSELECTED(Table))
Result = Table[Average Days] * Table[% Effectiveness]

 

I appreciated your help.

1 ACCEPTED SOLUTION

@ajimenez

 

Hi, Try with this DAX

 

Result =
SUMX (
    SUMMARIZE (
        Table1;
        Table1[Line];
        "RESULTS"; [AverageDays] * [% Effectiveness]
    );
    [RESULTS]
)

Review Your Column in Summarize accord to your visual & Structure.

 

S.png




Lima - Peru

View solution in original post

3 REPLIES 3
OpenDataLab
Helper II
Helper II

You need to use SUMX(table,[Result]).

 

The functions ending in X are iterator, which in lay-mans terms means they will loop through the rows in the current filter context calculating the result for each row before performing the final aggregation.

 

Thanks for your answer, but using SUMX is the same behavior, the real problem is that it applies the calculation even in the totals, it only adds the previous records only when they come from a defined table or column, not measures, because this applies the calculation for each row.

 

ItemAverage Days% EffectivenessResult with DAX
1128                   0,05128 * 0,05     = 6,4
2508                   0,30508 * 0,30     = 152,4
3994,5                   0,50994,5 * 0,50 = 497,25
4264                   0,15264 * 0,15    = 39,6
Grand Total473,625                      1473,625 * 1  = 473,625

Result = Table[Average Days] * Table[% Effectiveness]

 

I need another way to calculate this Result and being able to get the right value: 695,65

 

Thanks!!

@ajimenez

 

Hi, Try with this DAX

 

Result =
SUMX (
    SUMMARIZE (
        Table1;
        Table1[Line];
        "RESULTS"; [AverageDays] * [% Effectiveness]
    );
    [RESULTS]
)

Review Your Column in Summarize accord to your visual & Structure.

 

S.png




Lima - Peru

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 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.