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

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

Reply
jobf
Helper II
Helper II

Calculate sumproduct with variable values

I need to create a certain measure that calculates:

Date Quantity
2025/01/01 69
2025/01/02 69
2025/01/03 69
2025/01/01 120
2025/01/02 120
2025/01/01 200
2025/01/01 200
2025/01/02 200

I need a measure that calculates a kind of sumproduct, in which you need to multiply the quantity by the number of days it was implemented, then add these results together and finally, divide everything by the total number of days. Basically, make the following numerical expression:
((69 * 3) + (120 * 2) + (200 * 2))/3

In this previous example, the result on a card should be approximately 282.3

1 ACCEPTED SOLUTION
MasonMA
Community Champion
Community Champion

Hi, would this be the result you were looking?

 

Measure = 
VAR _SummaryTable = SUMMARIZECOLUMNS( 'Sample'[ Quantity], "DaysCount", DISTINCTCOUNT('Sample'[Date]) )
VAR _Numerator =
    SUMX(
        _SummaryTable,
        [ Quantity] * [DaysCount]
    )
VAR _Denominator =
    DISTINCTCOUNT('Sample'[Date])
VAR _Result= 
DIVIDE(_Numerator, _Denominator)

RETURN
_Result

MasonMA_0-1760548344961.png

 

View solution in original post

3 REPLIES 3
Ashish_Mathur
Super User
Super User

Hi,

PBI file attached.

Hope this helps.

Ashish_Mathur_0-1760584521904.png

 


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
MasonMA
Community Champion
Community Champion

Hi, would this be the result you were looking?

 

Measure = 
VAR _SummaryTable = SUMMARIZECOLUMNS( 'Sample'[ Quantity], "DaysCount", DISTINCTCOUNT('Sample'[Date]) )
VAR _Numerator =
    SUMX(
        _SummaryTable,
        [ Quantity] * [DaysCount]
    )
VAR _Denominator =
    DISTINCTCOUNT('Sample'[Date])
VAR _Result= 
DIVIDE(_Numerator, _Denominator)

RETURN
_Result

MasonMA_0-1760548344961.png

 

Jihwan_Kim
Super User
Super User

Hi,

I am not sure if I understood your question correctly, but please check the below picture and the attached pbix file.

 

Jihwan_Kim_0-1760548023130.png

Jihwan_Kim_1-1760548056875.png

 

 

 


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

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