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

Next 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

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
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

FabCon and SQLCon Highlights Carousel

FabCon &SQLCon Highlights

Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.