Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now
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
Solved! Go to Solution.
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)
Proud to be a Super User!
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)
Proud to be a Super User!
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
| User | Count |
|---|---|
| 52 | |
| 34 | |
| 33 | |
| 17 | |
| 17 |
| User | Count |
|---|---|
| 61 | |
| 60 | |
| 39 | |
| 26 | |
| 24 |