'SQL Server: Limit filling NULL values up to row with specific text
I have a CTE on which i am filling null values with the previous value before row 100 available by using the following script
SELECT [YearMonth],grp,
CASE WHEN grp>grp 
     THEN (FIRST_VALUE([Value 1]) over (partition by grp order by [YearMonth]))
The problem is that i want the rows after the "Latest" to be null but i dont want these rows to be deleted cause there are values in other columns which i need to show. I would appreciate of any help.
EDIT
Current Table
| YearMonth | Value 1 | 
|---|---|
| 2021-01 | 0.9575 | 
| 2021-02 | NULL | 
| 2021-03 | NULL | 
| 2021-04 | NULL | 
| 2021-05 | NULL | 
| 2021-06 | 0.9875 | 
Expected table
| YearMonth | Value 2 | 
|---|---|
| 2021-01 | 0.9575 | 
| 2021-02 | 0.9575 | 
| 2021-03 | 0.9575 | 
| 2021-04 | 0.9575 | 
| 2021-05 | 0.9575 | 
| 2021-06 | 0.9875 | 
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source | 
|---|
