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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
simaotc
Frequent Visitor

Add a calculated column based in an agregation of values in other columns

Hello community,

 

I have a table like the example below.

I would like to add the code if any column in STRING contains the text "AAA"

CODESTRINGExpected Result
111xxxxAAAxxx111
111xxxxxxxxxxx111
111xxxxxxxxxxx111
222xxxxxxxxxxx 
222xxxxxxxxxxx 
222xxxxxxxxxxx 
333xxxxxxxxxxxx333
333xxxxAAAxxx333

 

I know it's quite confuse but your help would be very appreciated.  

 

Thank you very much,
Simao

1 ACCEPTED SOLUTION
DataInsights
Super User
Super User

@simaotc,

 

Try this calculated column:

 

Code with AAA = 
VAR vCode = Table1[CODE]
VAR vTable =
    FILTER (
        Table1,
        Table1[CODE] = vCode
            && CONTAINSSTRING ( Table1[STRING], "AAA" )
    )
VAR vResult =
    IF ( ISEMPTY ( vTable ), BLANK (), vCode )
RETURN
    vResult

DataInsights_0-1699493519300.png

 





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

Proud to be a Super User!




View solution in original post

2 REPLIES 2
simaotc
Frequent Visitor

Thak you very much! It's Perfect

DataInsights
Super User
Super User

@simaotc,

 

Try this calculated column:

 

Code with AAA = 
VAR vCode = Table1[CODE]
VAR vTable =
    FILTER (
        Table1,
        Table1[CODE] = vCode
            && CONTAINSSTRING ( Table1[STRING], "AAA" )
    )
VAR vResult =
    IF ( ISEMPTY ( vTable ), BLANK (), vCode )
RETURN
    vResult

DataInsights_0-1699493519300.png

 





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

Proud to be a Super User!




Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

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.