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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
gbernardes_
Frequent Visitor

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 @gbernardes_ 

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 @gbernardes_ 

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
Super User
Super User

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

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

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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