cancel
Showing results for
Search instead for
Did you mean: New Member

## DAX get previous values from another DAX

Hi all,

I am new to DAX . So I am trying to build the `DAX Value 2` column. Below is what I am expecting for `DAX Value 2` column.

For the 'category' C, I want it to be the value of Category B on the measure instead of a running total.

Notes: both the DAX Value 1 and DAX Value 2 will be a Measure instead of from a Table 1 ACCEPTED SOLUTION  Community Support

Hi,  @wer1231

You can try the following steps.

1 Create a Calculated column with Measure DAX Value1

ColumnFromValue1 = [DAX_Value1]

2 Create a Measure

Accumulate =

VAR res =

CALCULATE (

SUMX ( 'Table', 'Table'[ColumnFromValue1] ),

FILTER ( ALLSELECTED ( 'Table' ), 'Table'[Index] <= MAX ( 'Table'[Index] ) )

)

VAR r1 =

LOOKUPVALUE ( 'Table'[ColumnFromValue1], 'Table'[Category], "A" )

VAR r2 =

LOOKUPVALUE ( 'Table'[ColumnFromValue1], 'Table'[Category], "B" )

VAR r3 = r1 + r2

RETURN

IF ( SELECTEDVALUE ( 'Table'[Category] ) = "C", r3, res )

The result looks like this: Best Regards,

Caiyun Zheng

Is that the answer you're looking for? If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. If not, please consider providing a sample removing sensitive data.

6 REPLIES 6  Community Support

Hi,  @wer1231

You can try the following steps.

1 Create a Calculated column with Measure DAX Value1

ColumnFromValue1 = [DAX_Value1]

2 Create a Measure

Accumulate =

VAR res =

CALCULATE (

SUMX ( 'Table', 'Table'[ColumnFromValue1] ),

FILTER ( ALLSELECTED ( 'Table' ), 'Table'[Index] <= MAX ( 'Table'[Index] ) )

)

VAR r1 =

LOOKUPVALUE ( 'Table'[ColumnFromValue1], 'Table'[Category], "A" )

VAR r2 =

LOOKUPVALUE ( 'Table'[ColumnFromValue1], 'Table'[Category], "B" )

VAR r3 = r1 + r2

RETURN

IF ( SELECTEDVALUE ( 'Table'[Category] ) = "C", r3, res )

The result looks like this: Best Regards,

Caiyun Zheng

Is that the answer you're looking for? If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. If not, please consider providing a sample removing sensitive data.  Super User III

Hi,

What result are you expecting?

Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/ New Member

Updated my post. Let me know if it is still unclear.... New Member

Sorry for the confusion. The `DAX Value 2` column is what I am expecting to achieve. Will modify my question right now...  Solution Sage

first try on the table tools theres a quick measure pane, you can find there a pre defined running total function just specify the parameters field for it and should get you on the road. New Member

But I am looking to get the previous row value for one specific row, if that make sense. PS: have modified my question above.  ## Helpful resources

Announcements #### Join us for our User Group Public Preview!

Power BI User Groups are coming! Make sure you’re among the first to know when user groups go live for public preview. #### The largest Power BI virtual conference

100+ sessions, 100+ speakers, Product managers, MVPs, and experts. All about Power BI. Attend online or watch the recordings. Top Solution Authors
Top Kudoed Authors
Users online (3,271)