Forum Discussion
Fill blank values with previous value
Hi ,
I m new to power bi ,I have below dataset. In Target 2 column , blank values filled with previous value.Please help me to write dax for same.
| Year-Week | TARGET | TARGET2 |
| 2020-25 | 14112 | 14112 |
| 2020-26 | 14112 | |
| 2020-27 | 10872 | 10872 |
| 2020-28 | 10872 | |
| 2020-29 | 10872 | |
| 2020-30 | 8928 | 8928 |
Thanks
Anonymous
You can use the below Measure, I only changed the EARLIER function to MAX.
Measure_Filldown = VAR LNBT = CALCULATE(MAX('Table'[YEAR-WEEK]), FILTER( ALL('Table'), 'Table'[YEAR-WEEK]<=MAX('Table'[YEAR-WEEK]) && 'Table'[TARGET]<>BLANK() ) ) RETURN CALCULATE( MAX([TARGET]), 'Table'[YEAR-WEEK] = LNBT ,ALL('Table') )
Did I answer your question? Mark my post as a solution!
11 Replies
- rajulshahResident Rockstar
Hello Anonymous,
Do you want this to be resolved in Power Query or DAX function? Please let me know.
- AnonymousNot applicable
DAX Measure
- FowmySuper User
Hi,
Try this as a new column.VAR LNBT = CALCULATE(MAX('Table'[YEAR-WEEK]), FILTER( ALL('Table'), 'Table'[YEAR-WEEK]<=EARLIER('Table'[YEAR-WEEK]) && 'Table'[TARGET]<>BLANK() ) ) RETURN CALCULATE( MAX([TARGET]), 'Table'[YEAR-WEEK] = LNBT ,ALL('Table') )Did I answer your question? Mark my post as a solution!
- AnonymousNot applicable
Hey,
Thanks its working. I m trying same formula in measure but its giving error.
Can you tell me reason we couldnt use this formula in measure.
Thanks
- FowmySuper User
Anonymous
Evaluation context in Column (Table) and Measure are different in this case.
Thanks
Did I answer your question? Mark my post as a solution!