Don't miss your chance to take the Fabric Data Engineer (DP-600) exam for FREE! Find out how by attending the DP-600 session on April 23rd (pacific time), live or on-demand.
Learn moreNext up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. 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!
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.
| User | Count |
|---|---|
| 48 | |
| 40 | |
| 37 | |
| 20 | |
| 15 |
| User | Count |
|---|---|
| 70 | |
| 67 | |
| 32 | |
| 27 | |
| 25 |