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
hpayne93
Frequent Visitor

DAX with text filter

Hi,

 

I need to add a new measure to sum the total of newsletter sends. Currently my measure shows the total of ALL email campaign sends - this includes newsletters, webinar invites etc. 

 

Newsletter sends = CALCULATE(SUM('Mailchimp Campaign'[Send]), USERELATIONSHIP('Mailchimp Campaign'[Sent On],'Date'[Date]))
 
What do I need to add to my measure so I am only calculating sends where the 'name'(mailchimp campaign) column contains 'newsletter'?
 
Thanks!
1 ACCEPTED SOLUTION

Try this

CALCULATE(
SUM('Mailchimp Campaign'[Send]), 
FILTER(
	'Mailchimp Campaign',
	CONTAINSSTRING('Mailchimp Campaign'[Name],"newsletter")
),
USERELATIONSHIP('Mailchimp Campaign'[Sent On],'Date'[Date]))

View solution in original post

5 REPLIES 5
grazitti_sapna
Super User
Super User

To calculate the total number of newsletter sends, you can modify your measure by adding a filter condition using the CONTAINS function. Here's an example of how you can modify your measure to only calculate sends where the 'name' column contains 'newsletter':

Newsletter sends =

CALCULATE(

SUM('Mailchimp Campaign'[Send]),

USERELATIONSHIP('Mailchimp Campaign'[Sent On], 'Date'[Date]),

CONTAINS('Mailchimp Campaign', 'Mailchimp Campaign'[name], "newsletter")

)

Thank you 

vk_pbi
Resolver II
Resolver II

Hi @hpayne93 

I havent' tested the below code, it should work

CALCULATE(
SUM('Mailchimp Campaign'[Send]), 
FILTER(
	'Mailchimp Campaign',
	'Mailchimp Campaign'[Name] = 'newsletter'
),
USERELATIONSHIP('Mailchimp Campaign'[Sent On],'Date'[Date]))

 

Hey, thanks for the reply!

 

That doesn't quite work. I want to see the total where 'mailchimp campaign' [name] contains 'newsletter' -- do i need to use CONTAINSSTRING?

Try this

CALCULATE(
SUM('Mailchimp Campaign'[Send]), 
FILTER(
	'Mailchimp Campaign',
	CONTAINSSTRING('Mailchimp Campaign'[Name],"newsletter")
),
USERELATIONSHIP('Mailchimp Campaign'[Sent On],'Date'[Date]))

It worked! Thanks very much 

Helpful resources

Announcements
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.

May 2025 Monthly Update

Fabric Community Update - May 2025

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