Forum Discussion
MarshalSK
2 years agoResolver I
How to get previous row in Matrix
Hi Folks, Need your expertise to get the previous row if present row is null using DAX (for each region). Region Category Sub-Category Profit YearMonth Sales East A A1 0 20...
- 2 years ago
MarshalSK correct.
I'm thinking I misread the request but you can use the below to achieve the outcome you want rather than the first solution I proposed (Column 2). Just adjust the name of your table and columns to match yours and you will get the output that matches your initial post.
Column 2 = IF( ISBLANK ( Table2[Sales] ) , CALCULATE( MAX( 'Table2'[Sales] ) , FILTER ( Table2 , [Region] = EARLIER ( [Region] ) && [YearMonth] < EARLIER ( [YearMonth] ) ) ) , [Sales] )Hope this helps mate! 🙂
Theo
TheoC
2 years agoCommunity Champion
MarshalSK correct.
I'm thinking I misread the request but you can use the below to achieve the outcome you want rather than the first solution I proposed (Column 2). Just adjust the name of your table and columns to match yours and you will get the output that matches your initial post.
Column 2 =
IF(
ISBLANK ( Table2[Sales] ) ,
CALCULATE(
MAX( 'Table2'[Sales] ) ,
FILTER (
Table2 ,
[Region] = EARLIER ( [Region] ) &&
[YearMonth] < EARLIER ( [YearMonth] )
)
) ,
[Sales]
)
Hope this helps mate! 🙂
Theo