Forum Discussion
Continous line chart, previous value for blank data
Hello,
With the following data, I want to show on a continuous line chart the value per SKU during september. It's a stock value so basicaly, between the 25/09 and 29/09 for the SKU A, I want the value to remain at 8 (before a drop to 3 the 29/09).
So I don't want blank value to be 0, I would like to get the previous value if blank.
| Date | SKU | Index | Value |
| 29-sept | A | 1 | 3 |
| 25-sept | A | 2 | 8 |
| 19-sept | B | 3 | 9 |
| 18-sept | A | 4 | 1 |
| 06-sept | B | 5 | 3 |
| 01-sept | B | 6 | 0 |
Thank you for your help !! Best regards
Marie
- Anonymous2 years ago
HI Anonymous,
Did these blank parts real include in your table records? If that is the case, you can check the current value if it equal to zero and use expression to look up the previous data values.
If the blank part means record not existed in table, you may need to use a new calendar table date field as axis and write measure expression to lookup current table to get previous result.formula = VAR currDate = MAX ( DateTable[Date] ) VAR exist = CALCULATE ( COUNTROWS ( Table1 ), FILTER ( ALLSELECTED ( Table1 ), [Date] = currDate ), VALUES ( Table1[SKU] ) ) VAR prevDate = CALCULATE ( MAX ( Table1[Date] ), FILTER ( ALLSELECTED ( Table1 ), [Date] < currDate ) ) RETURN IF ( exist > 0, SUM ( Table1[Value] ), CALCULATE ( SUM ( Table1[Value] ), FILTER ( ALLSELECTED ( Table1 ), [Date] = prevDate ), VALUES ( Table1[SKU] ) ) )Regards,
Xiaoxin Sheng
2 Replies
- AnonymousNot applicable
Any help ? thank
- AnonymousNot applicable
HI Anonymous,
Did these blank parts real include in your table records? If that is the case, you can check the current value if it equal to zero and use expression to look up the previous data values.
If the blank part means record not existed in table, you may need to use a new calendar table date field as axis and write measure expression to lookup current table to get previous result.formula = VAR currDate = MAX ( DateTable[Date] ) VAR exist = CALCULATE ( COUNTROWS ( Table1 ), FILTER ( ALLSELECTED ( Table1 ), [Date] = currDate ), VALUES ( Table1[SKU] ) ) VAR prevDate = CALCULATE ( MAX ( Table1[Date] ), FILTER ( ALLSELECTED ( Table1 ), [Date] < currDate ) ) RETURN IF ( exist > 0, SUM ( Table1[Value] ), CALCULATE ( SUM ( Table1[Value] ), FILTER ( ALLSELECTED ( Table1 ), [Date] = prevDate ), VALUES ( Table1[SKU] ) ) )Regards,
Xiaoxin Sheng