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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Using CONTAINS to filter a column

Hi All
 
I am trying to sum a column of $ values with a filter being applied to 2 other columns. 
e.g., I want to sum the sales revenue column when the Intake column CONTAINS the word Intensive and the student booking date is greater than Jun 21. 
Below is what I have but it isn't bringing any values through. 
I have read a few posts and tried a few different things but still no luck. 
Any assistance is greatly appreciated. 
 
Sales Revenue Intensive only > Jun21 =
CALCULATE (
SUM ( 'Sales Reports'[Sales Revenue] ),
CONTAINSSTRING('Sales Reports'[Intake],"Intensive"),
'Sales Reports'[Student Booking Date] > DATE ( 2021, 5, 31 )
)
 
Cheers
Karen
1 ACCEPTED SOLUTION
VahidDM
Super User
Super User

Hi @Anonymous 

 

You measure is correct and works well.

I checked that with sample data and resualt for >Jun21 and >Jul21 are as below:

VahidDM_1-1629173590005.png

VahidDM_2-1629173728489.png

 

 

The measure @amitchandak shared has more advantages for you as you can see that on the table.

Please share the data in the table format to be able to review that.

 

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

Appreciate your Kudos VahidDM_3-1629173792221.png !!

View solution in original post

3 REPLIES 3
VahidDM
Super User
Super User

Hi @Anonymous 

 

You measure is correct and works well.

I checked that with sample data and resualt for >Jun21 and >Jul21 are as below:

VahidDM_1-1629173590005.png

VahidDM_2-1629173728489.png

 

 

The measure @amitchandak shared has more advantages for you as you can see that on the table.

Please share the data in the table format to be able to review that.

 

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

Appreciate your Kudos VahidDM_3-1629173792221.png !!

amitchandak
Super User
Super User

@Anonymous , Try with small change

 

CALCULATE (
SUM ( 'Sales Reports'[Sales Revenue] ),
filter('Sales Reports', CONTAINSSTRING('Sales Reports'[Intake],"Intensive") &&
'Sales Reports'[Student Booking Date] > DATE ( 2021, 5, 31 )
))

 

 

or

 

Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.

Anonymous
Not applicable

@VahidDM Thank you. I re checked my measure and it appears that I had mysteriously put a comma somewhere that shouldn't have been there. 😞 Apologies for this. Thank you for taking the time to check it. 

Cheers

Karen

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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