Forum Discussion
REKLP
Helper I
7 years agoUse previous data to fill in blanks in table
I have gaps between my data. I'd like to fill them in with the previous data, for example. I tried using an if statement (shown below), but it doesn't seem to work because there'...
v-yulgu-msft
Microsoft Employee
7 years agoHi REKLP,
Based on my assumption, I test with below sample dataset. The left two visuals show data table, they are linked by [Year_Month] field. The right visual is the expected result.
CountofrowsinTable = COUNT(Appendedtable[Active])
result = VAR previousnonblankvalue = IF ( [CountofrowsinTable] = BLANK (), CALCULATE ( MIN ( Appendedtable[Year_Month] ), FILTER ( ALLSELECTED ( yearmonth ), yearmonth[Year_Month] > MAX ( yearmonth[Year_Month] ) ) ), BLANK () ) RETURN IF ( [CountofrowsinTable] = BLANK (), CALCULATE ( [CountofrowsinTable], FILTER ( ALLSELECTED ( yearmonth[Year_Month] ), yearmonth[Year_Month] = previousnonblankvalue ) ), [CountofrowsinTable] )
Best regards,
Yuliana Gu
REKLP
Helper I
7 years agoHi v-yulgu-msft,
I tried your code, but it doesn't seem to work when using my data model. The following link is a sample of the data I'm working with, if you'd like to try.
https://www.dropbox.com/s/ab8lh8wcwulxrx8/Demo.pbix?dl=0