Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
gianmarco
Helper IV
Helper IV

Calculated column

Hey there!

Got a question. Considering the following table:

CODEDESCVALUE
ADesc120
A

Desc2

50
AX100
BDesc110
BDesc230
BDesc360
CDesc1100
CX30
CDesc240
CDesc350

 

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:

CODEDESCVALUENEW COLUMN
ADesc12040
A

Desc2

50100
AX100null
BDesc110null
BDesc230null
BDesc360null
CDesc1100200
CX30null
CDesc24080
CDesc350100

 

Thanks for your support 🙂

gianmarco

 

1 ACCEPTED SOLUTION
ryan_mayu
Super User
Super User

@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)

1.PNG





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

1 REPLY 1
ryan_mayu
Super User
Super User

@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)

1.PNG





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.