DAX calculated column for INDEX based on two columns: Date and Item.
Hi Comunity!
I'd like to create the two calculated columns in DAX at the right of the following data:
Date | Well | Oil | Water | Gas | RunningActMonth | RunningMonth |
---|---|---|---|---|---|---|
01/01/1990 | PP-0001 | 0 | 0 | 0 | 0 | 0 |
01/02/1990 | PP-0001 | 0 | 0 | 0 | 0 | 0 |
01/03/1990 | PP-0001 | 0 | 0 | 0 | 0 | 0 |
01/04/1990 | PP-0001 | 0 | 0 | 0 | 0 | 0 |
01/05/1990 | PP-0001 | 0 | 0 | 0 | 0 | 0 |
01/06/1990 | PP-0001 | 0 | 0 | 0 | 0 | 0 |
01/07/1990 | PP-0001 | 0 | 0 | 0 | 0 | 0 |
01/08/1990 | PP-0001 | 0 | 0 | 0 | 0 | 0 |
01/09/1990 | PP-0001 | 0 | 0.2 | 0 | 1 | 1 |
01/10/1990 | PP-0001 | 0 | 5 | 0 | 2 | 2 |
01/11/1990 | PP-0001 | 1 | 2 | 50 | 3 | 3 |
01/12/1990 | PP-0001 | 1.5 | 4 | 75 | 4 | 4 |
01/01/1991 | PP-0001 | 3 | 6 | 150 | 5 | 5 |
01/02/1991 | PP-0001 | 4.5 | 18 | 225 | 6 | 6 |
01/03/1991 | PP-0001 | 6 | 2 | 300 | 7 | 7 |
01/04/1991 | PP-0001 | 5 | 1 | 250 | 8 | 8 |
01/05/1991 | PP-0001 | 2 | 3 | 100 | 9 | 9 |
01/06/1991 | PP-0001 | 0 | 0 | 0 | 9 | 10 |
01/07/1991 | PP-0001 | 0 | 0 | 0 | 9 | 11 |
01/08/1991 | PP-0001 | 0 | 0 | 0 | 9 | 12 |
01/09/1991 | PP-0001 | 0 | 0 | 0 | 9 | 13 |
01/10/1991 | PP-0001 | 8 | 2 | 400 | 10 | 14 |
01/11/1991 | PP-0001 | 4 | 3 | 200 | 11 | 15 |
01/12/1991 | PP-0001 | 3 | 5 | 150 | 12 | 16 |
Explanation: I have several Items called "Wells". For each one of them, I have monthly data (oil, water, and gas production). For each well I'd like to find the first production data > 0, and from then start to count an Index column.
- The first column "RunningActMonth" would count every time one of the production columns is greater than zero, but it will repeat the earlier index if the production = 0.
- The second column "RunningMonth" would keep indexing forever after the First production data.
Your help will be much appreciated. Regards from Argentina.