cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
spandy34
Helper III
Helper III

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
PijushRoy
Continued Contributor
Continued Contributor

@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
Continued Contributor
Continued Contributor

@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

 

PijushRoy
Continued Contributor
Continued Contributor

@spandy34 

Please paste some sample data here or share pbix 

PijushRoy
Continued Contributor
Continued Contributor

@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
Helper III
Helper III

Helpful resources

Announcements
June 2022 update 768X460.jpg

Check it out!

Click here to read more about the June 2022 updates!

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Power BI Dev Camp Session 23 768x460.jpg

Check it Out!

Mark your calendars and join us on Thursday, June 30 at 11a PDT for a great session with Ted Pattison!

June 20 episode 7 with aka link 768x460.jpg

The Power BI Community Show

Join us on June 20 at 11 am PDT when Kim Manis shares the latest on Azure Synapse analytics, the Microsoft Intelligent Data Platform, and notable Power BI Updates from Microsoft Build 2022.

Top Solution Authors
Top Kudoed Authors