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

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

Reply
spandy34
Responsive Resident
Responsive Resident

DAX Contains Text Statement

I am trying to calculate the total cost of Amount Recovered using [Net] field of the records within the  Main Claim Data field that has OT in the ClassofBusinessCode and the PolicyCode contains REC - the Policy Code needs to contain REC as opposed to is REC - the code below is not working - can anyone help
 
 
Amount Recovered Uninsured Loss £ = SUMX ( FILTER ( 'Main Claim Data', [ClassOfBusinessCode] = "OT" ),
&& CONTAINSSTRINGEXACT ( [PolicyCode], "REC" )
[Net] )
1 ACCEPTED SOLUTION

@spandy34 

Please create a calculated colum (dont give space between table name and col name)
calculatedcolumn = SEARCH("REC",'Table'[PolicyCode],,-1)
Then create measure
= CALCULATE(SUM('Table'[Net]),'Main Claim Data', [ClassOfBusinessCode] = "OT" && 'Main Claim Data',[calculatedcolumn] > 0)

If solve your requirement, please mark this answer as SOLUTION
If this comment helps you, please LIKE this comment/Kudos




Did I answer your question? Mark my post as a solution!
Appreciate your Like/Kudos

Proud to be a Super User!





View solution in original post

5 REPLIES 5
PijushRoy
Super User
Super User

@spandy34 
Please try this,
= VAR _rec = SEARCH("REC",'Table'[PolicyCode],,-1)
RETURN
CALCULATE(SUM('Table'[Net]),'Main Claim Data', [ClassOfBusinessCode] = "OT" && _rec > 0)

If not solved, please keep posted (paste sample data)
If solve your requirement, please mark this answer as SOLUTION
If this comment helps you, please LIKE this comment/Kudos




Did I answer your question? Mark my post as a solution!
Appreciate your Like/Kudos

Proud to be a Super User!





This is the message I get

spandy34_0-1645563198646.png

 

@spandy34 

Please paste some sample data here or share pbix 




Did I answer your question? Mark my post as a solution!
Appreciate your Like/Kudos

Proud to be a Super User!





@spandy34 

Please create a calculated colum (dont give space between table name and col name)
calculatedcolumn = SEARCH("REC",'Table'[PolicyCode],,-1)
Then create measure
= CALCULATE(SUM('Table'[Net]),'Main Claim Data', [ClassOfBusinessCode] = "OT" && 'Main Claim Data',[calculatedcolumn] > 0)

If solve your requirement, please mark this answer as SOLUTION
If this comment helps you, please LIKE this comment/Kudos




Did I answer your question? Mark my post as a solution!
Appreciate your Like/Kudos

Proud to be a Super User!





spandy34
Responsive Resident
Responsive Resident

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.