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

Join the FabCon + SQLCon recap series. Up next: Power BI, Real-Time Intelligence, IQ and AI, and Data Factory take center stage. All sessions are available on-demand after the live show. Register now

Reply
griffinst
Helper I
Helper I

SumX

I'm trying to do a SUMX in power BI to replicate a SUMPRODUCT calculation in excel.

1.  Need to multiply "value" from 2025 to "value2" from 2026 for each "metric" except TOTAL, then sum all of those together

2.  Divide by the "TOTAL" "2025" "value"

3.  Calculation should equal 814

 

 

metricdate_typedate_valuedate_yeardate_mnthvaluevalue2
SilverYTD20262026125177687.7883
GoldYTD20262026136978933.6245
BronzeYTD2026202619760584.8406
PlatinumYTD2026202615867948.8928
TOTALYTD20262026177782811.4372
GoldYTD20252025142170788.2152
TOTALYTD20252025188108739.1471
SilverYTD20252025128056695.0274
BronzeYTD20252025110721535.6867
PlatinumYTD2025202517161927.6576
4 REPLIES 4
cengizhanarslan
Super User
Super User

Please try the measure below:

cengizhanarslan_1-1777560531624.png

SUMPRODUCT Result = 
VAR _2025Rows =
    CALCULATETABLE (
        ADDCOLUMNS (
            SUMMARIZE (
                FactTable,
                FactTable[metric]
            ),
            "Val2025",
                CALCULATE ( MAX ( FactTable[value] ) )
        ),
        FactTable[date_year] = 2025,
        FactTable[metric] <> "TOTAL",
        ALL ( FactTable )
    )

VAR _Total2025 =
    CALCULATE (
        MAX ( FactTable[value] ),
        FactTable[metric] = "TOTAL",
        FactTable[date_year] = 2025,
        ALL ( FactTable )
    )

VAR _WithVal2026 =
    ADDCOLUMNS (
        _2025Rows,
        "Val2026",
            CALCULATE (
                MAX ( FactTable[value2] ),
                TREATAS ( { [metric] }, FactTable[metric] ),
                FactTable[date_year] = 2026,
                ALL ( FactTable )
            )
    )

VAR _Result =
    SUMX ( _WithVal2026, [Val2025] * [Val2026] )

RETURN
    DIVIDE ( _Result, _Total2025 )
_________________________________________________________
If this helped, ✓ Mark as Solution | Kudos appreciated
Connect on LinkedIn | Follow on Medium
AI-assisted tools are used solely for wording support. All conclusions are independently reviewed.
Ashish_Mathur
Super User
Super User

Hi,

Please share the download link of the MS Excel file with your SUMPRODUCT() formula already written there.  I will convert that logic into DAX measures.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
griffinst
Helper I
Helper I

result should be 814 not 10.1% sorry for the mistake.

jgeddes
Super User
Super User

I am not sure I see how your calculation equals 10.1%, but here is a measure you can play with...

jgeddes_0-1777482969388.png

Measure = 
var _total = 
MINX(
    FILTER(
        ALL('Table'), 
        'Table'[date_year] = 2025 && 'Table'[metric] = "TOTAL"
    ), 
    [value]
)
var _calc = 
SUMX(
    SUMMARIZE(
        FILTER(
            'Table', 
            'Table'[metric] <> "TOTAL"
        ), 
        'Table'[metric], 
        "__v1", 
        MINX(
            FILTER(
                'Table', 
                'Table'[date_year] = 2025
            ), 
            [value]
        ), 
        "__v2", 
        MINX(
            FILTER(
                'Table', 
                'Table'[date_year] = 2026
            ), 
            [value2]
        )
    ),
    [__v1] * [__v2]
)
var _result =
IF(
    SELECTEDVALUE('Table'[metric]) <> "TOTAL",
    DIVIDE(
        _calc,
        _total,        
        0
    ),
    BLANK()
)
RETURN
_result




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

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

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.

FabCon and SQLCon Highlights Carousel

FabCon & SQLCon Highlights

Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.