Forum Discussion
MarshalSK
Resolver I
2 years agoHow 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
Community Champion
2 years agoMarshalSK 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