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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
Anonymous
Not applicable

Help with DAX to sum the previous value

I need to do this formula in a DAX table:
1- First row = A * B
2- Second Row until the end = B * E (result of row before)

gbernardes__1-1683316402030.png

Can I do it in dax?

 

 

1 ACCEPTED SOLUTION
tamerj1
Super User
Super User

Hi @Anonymous 

I didn't have the chance to test it so please do from your end

Value =
VAR T1 =
CALCULATETABLE ( 'Table', ALLEXCEPT ( 'Table', 'Table'[Key AP] ) )
VAR Index1 =
MINX ( T1, 'Table'[Index] )
VAR Value1 =
MAXX (
FILTER ( T1, 'Table'[Index] = Index1 ),
'Table'[Valor] * ( 'Table'[INCC-M. Valor] + 1 )
)
VAR T2 =
FILTER (
T1,
'Table'[Index] <= EARLIER ( 'Table'[Index] )
&& 'Table'[Index] > Index1
)
VAR ProductValue =
PRODUCTX ( T2, 'Table'[INCC-M. Valor] + 1 )
RETURN
Value1 * COALESCE ( ProductValue, 1 )

View solution in original post

3 REPLIES 3
tamerj1
Super User
Super User

Hi @Anonymous 

I didn't have the chance to test it so please do from your end

Value =
VAR T1 =
CALCULATETABLE ( 'Table', ALLEXCEPT ( 'Table', 'Table'[Key AP] ) )
VAR Index1 =
MINX ( T1, 'Table'[Index] )
VAR Value1 =
MAXX (
FILTER ( T1, 'Table'[Index] = Index1 ),
'Table'[Valor] * ( 'Table'[INCC-M. Valor] + 1 )
)
VAR T2 =
FILTER (
T1,
'Table'[Index] <= EARLIER ( 'Table'[Index] )
&& 'Table'[Index] > Index1
)
VAR ProductValue =
PRODUCTX ( T2, 'Table'[INCC-M. Valor] + 1 )
RETURN
Value1 * COALESCE ( ProductValue, 1 )

eliasayyy
Memorable Member
Memorable Member

switch(
true(),
index =3 , ( [column A] * [Column B] )+ [Column A],
index >=4, ([column E] * [Column B] ) +[Column E]
)

Anonymous
Not applicable

@Anonymous the problem is: [Column E] in power BI is the calculated column. I can't use it in this formula.

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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

Top Solution Authors