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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
spandy34
Post Patron
Post Patron

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

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

This is the message I get

spandy34_0-1645563198646.png

 

@spandy34 

Please paste some sample data here or share pbix 

@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

spandy34
Post Patron
Post Patron

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors