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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
CupidC
Helper II
Helper II

Multiplying Row-by-Row in a Table

Hello, I'm seeking assistance on how to perform row-by-row multiplication within a table, (measure or calculated column) similar to the SUMX function, but instead of iterating through each row to sum, I'm looking to multiply each row in a table.

For instance, considering the table below where the first column represents the month, the second column represents the interest rate, and the third column represents the cumulative interest rate. To calculate the cumulative interest rate, for month 3, we need to multiply the interest rate of the first month by the interest rate of the second month, and then by the interest rate of the third month.

CupidC_0-1708316196658.png

Any assistance or insights on how to achieve this would be greatly appreciated. Thank you in advance for your help.

3 ACCEPTED SOLUTIONS
Jihwan_Kim
Super User
Super User

Hi,

Please check the below picture and the attached pbix file.

It is for creating a measure.

Jihwan_Kim_0-1708318643659.png

 

 

PRODUCTX function (DAX) - DAX | Microsoft Learn

 

WINDOW function (DAX) - DAX | Microsoft Learn

 

expected result measure: = 
CALCULATE (
    PRODUCTX ( Data, Data[Interest Rate] ),
    WINDOW (
        1,
        ABS,
        0,
        REL,
        SUMMARIZE ( ALL ( Data ), Data[Month], Data[Interest Rate] ),
        ORDERBY ( Data[Month], ASC )
    )
)

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.


Visit my LinkedIn page by clicking here.


Schedule a meeting with me to discuss further by clicking here.

View solution in original post

vicky_
Super User
Super User

Try the following measure:

Cumulative Rate = PRODUCTX(FILTER(ALL('Table'), 'Table'[Month] <= EARLIER('Table'[Month])), 'Table'[Interest Rate])

Assuming that the Month column is unique (or at least, you can find a way to make it so that it's unique by combining it with a year number or you can use some sort of index column instead).

View solution in original post

sorry I forgot to add a column 'Table'[Intere Rate]
Screenshot_2.png

View solution in original post

5 REPLIES 5
vicky_
Super User
Super User

Try the following measure:

Cumulative Rate = PRODUCTX(FILTER(ALL('Table'), 'Table'[Month] <= EARLIER('Table'[Month])), 'Table'[Interest Rate])

Assuming that the Month column is unique (or at least, you can find a way to make it so that it's unique by combining it with a year number or you can use some sort of index column instead).

Ahmedx
Super User
Super User

pls try this

Screenshot_1.png

Hi Ahmedx, thanks for your help, but the cummulative rate does not seem to be correct, for example year 5 should be 1.638... anyway i can modify the formula to make it work?

sorry I forgot to add a column 'Table'[Intere Rate]
Screenshot_2.png
Jihwan_Kim
Super User
Super User

Hi,

Please check the below picture and the attached pbix file.

It is for creating a measure.

Jihwan_Kim_0-1708318643659.png

 

 

PRODUCTX function (DAX) - DAX | Microsoft Learn

 

WINDOW function (DAX) - DAX | Microsoft Learn

 

expected result measure: = 
CALCULATE (
    PRODUCTX ( Data, Data[Interest Rate] ),
    WINDOW (
        1,
        ABS,
        0,
        REL,
        SUMMARIZE ( ALL ( Data ), Data[Month], Data[Interest Rate] ),
        ORDERBY ( Data[Month], ASC )
    )
)

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.


Visit my LinkedIn page by clicking here.


Schedule a meeting with me to discuss further by clicking here.

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

Find out what's new and trending in the Fabric Community.

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

Check out the November 2024 Power BI update to learn about new features.