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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

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.

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
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
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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

Top Solution Authors