Forum Discussion
gianmarco
3 years agoHelper IV
Calculated column
Hey there!
Got a question. Considering the following table:
| CODE | DESC | VALUE |
| A | Desc1 | 20 |
| A | Desc2 | 50 |
| A | X | 100 |
| B | Desc1 | 10 |
| B | Desc2 | 30 |
| B | Desc3 | 60 |
| C | Desc1 | 100 |
| C | X | 30 |
| C | Desc2 | 40 |
| C | Desc3 | 50 |
I need to create a Calculated Column based on the following condition:
If a certain code "contains" Desc X, then calculate the double of column value EXCEPT the X's values.
The result would be the following table:
| CODE | DESC | VALUE | NEW COLUMN |
| A | Desc1 | 20 | 40 |
| A | Desc2 | 50 | 100 |
| A | X | 100 | null |
| B | Desc1 | 10 | null |
| B | Desc2 | 30 | null |
| B | Desc3 | 60 | null |
| C | Desc1 | 100 | 200 |
| C | X | 30 | null |
| C | Desc2 | 40 | 80 |
| C | Desc3 | 50 | 100 |
Thanks for your support 🙂
gianmarco
pls try this
Column = VAR _x=maxx(FILTER('Table (2)','Table (2)'[CODE]=EARLIER('Table (2)'[CODE])&&'Table (2)'[DESC]="X"),'Table (2)'[VALUE]) return if(ISBLANK(_x)||'Table (2)'[DESC]="X",blank(), 'Table (2)'[VALUE]*2)