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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
Fantmas
Helper III
Helper III

Calculation by Row by Year

Hi all,

I am trying to create a measure to Dynamically calculate by row a value through year :

 

In my first table I have the value a & b
a is a decimal number
b is a integer

In a another table I have my value:

t is the year starting from 1 and go up to 6

the year can dynamically change and I am stuck in my DAx formula as I am using CALCULATE and SUM 

Supply = 


CALCULATE( CALCULATE(SUM(a) * POWER((1 - SUM(b),t))



In excel the formula is as Follow :

a * (1 - b ) ^ t

3 REPLIES 3
tamerj1
Super User
Super User

Hi @Fantmas 
Please try

Supply =
VAR t =
    SELECTEDVALUE ( Table2[Year] )
RETURN
    SUMX (
        Table1,
        VAR a = Table1[ValueA]
        VAR b = Table1[ValueB]
        RETURN
            a * ( 1 - b ) ^ t
    )
MatthRichardsUK
Resolver I
Resolver I

To replicate this formula in DAX, you can try the following:

Supply =
CALCULATE(
SUM(a) * POWER(1 - SUM(b), t),
ALLSELECTED(table)
)

This will calculate the value of Supply using the values of a and b in the current context, and raise the result of 1 - SUM(b) to the power of t. The ALLSELECTED function is used to remove any filters on table, so that the full range of a and b values is used in the calculation.

If you want to use a specific year value for t instead of a dynamic value, you can replace the t column reference with a fixed value or another measure. For example:

Supply =
CALCULATE(
SUM(a) * POWER(1 - SUM(b), 3),
ALLSELECTED(table)
)

This would calculate the value of Supply using the values of a and b in the current context, and raise the result of 1 - SUM(b) to the power of 3.

I hope this helps! Let me know if you have any further questions.

Hi Matth,

Thank you for your answer, I tried your solution but it is not working, I should find a figures around 600 for my test but I find a figures around 2M,

My assumption it is POWER function is done after the sum function that create the issue

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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