My current result:
| No. | Column A | Column B | Column C |
|---|---|---|---|
| 1 | A | AB | col_amount |
| 2 | col_amount | ||
| 3 | col_amount | ||
| 4 | B | AS | col_amount |
| 5 | col_amount | ||
| 6 | T | TV | col_amount |
I want to get:
| No. | Column A | Column B | Column C |
|---|---|---|---|
| 1 | A | AB | col_amount |
| col_amount | |||
| col_amount | |||
| 2 | B | AS | col_amount |
| col_amount | |||
| 3 | T | TV | col_amount |
Following your previous question, you can use the
DENSE_RANKanalytic function in aCASEexpression.Given the sample data (slightly different than the question to show changes in
column_bwhencolumn_aremains the same):Then, if you want to number based on changes in
column_aandcolumn_bthen:Which outputs:
Or, if you only want to number based on changes in
column_athen you can use:Which outputs:
fiddle