<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	
	>
<channel>
	<title>
	Comments on: How to use CASE statements in Google Data Studio? &#8211; 2021	</title>
	<atom:link href="https://www.datastudio.ca/functions/how-to-use-the-case-function-in-google-data-studio/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.datastudio.ca/functions/how-to-use-the-case-function-in-google-data-studio/</link>
	<description>AI and Analytics Tips, Techniques and Tutorials</description>
	<lastBuildDate>Tue, 09 May 2023 16:39:21 +0000</lastBuildDate>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.8.3</generator>
	<item>
		<title>
		By: Dhruv		</title>
		<link>https://www.datastudio.ca/functions/how-to-use-the-case-function-in-google-data-studio/#comment-1251</link>

		<dc:creator><![CDATA[Dhruv]]></dc:creator>
		<pubDate>Tue, 09 May 2023 16:39:21 +0000</pubDate>
		<guid isPermaLink="false">https://datastudio.ca/?p=746#comment-1251</guid>

					<description><![CDATA[I&#039;m running 2 separate campaigns &#039;Brand V1&#039; and &#039;Generic V1&#039;. 
I want to see the performance for V1 campaign (combined)
I am using this:
CASE
WHEN REGEXP_MATCH(Campaign, &quot;.*V1.*&quot;) THEN &quot;V1&quot;
END
I am able to see the correct metrics (Impressions, Clicks, Cost). However, CTR, Impression share, Impression share Lost Budget is also being added together rather than displaying the actual aggregate.
How to resolve this?]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m running 2 separate campaigns &#8216;Brand V1&#8217; and &#8216;Generic V1&#8217;.<br />
I want to see the performance for V1 campaign (combined)<br />
I am using this:<br />
CASE<br />
WHEN REGEXP_MATCH(Campaign, &#8220;.*V1.*&#8221;) THEN &#8220;V1&#8221;<br />
END<br />
I am able to see the correct metrics (Impressions, Clicks, Cost). However, CTR, Impression share, Impression share Lost Budget is also being added together rather than displaying the actual aggregate.<br />
How to resolve this?</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Deniz Kutan		</title>
		<link>https://www.datastudio.ca/functions/how-to-use-the-case-function-in-google-data-studio/#comment-1193</link>

		<dc:creator><![CDATA[Deniz Kutan]]></dc:creator>
		<pubDate>Mon, 17 Apr 2023 19:13:40 +0000</pubDate>
		<guid isPermaLink="false">https://datastudio.ca/?p=746#comment-1193</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://www.datastudio.ca/functions/how-to-use-the-case-function-in-google-data-studio/#comment-1192&quot;&gt;Vanik&lt;/a&gt;.

Hey Vanik, the &quot;+&quot; is considered a special regular expression character, which has a specific function. If you still want to use it, then you will have to use the &quot;\&quot; character following the &quot;+&quot; to tell the RegEx not to use it as character with special meaning (in other words &quot;B+\G&quot;). Here is more info on &lt;a href=&quot;https://cheatography.com/davechild/cheat-sheets/regular-expressions/&quot; target=&quot;_blank&quot; rel=&quot;noopener nofollow ugc&quot;&gt;regular expressions that describes those characters.&lt;/a&gt;]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://www.datastudio.ca/functions/how-to-use-the-case-function-in-google-data-studio/#comment-1192">Vanik</a>.</p>
<p>Hey Vanik, the &#8220;+&#8221; is considered a special regular expression character, which has a specific function. If you still want to use it, then you will have to use the &#8220;\&#8221; character following the &#8220;+&#8221; to tell the RegEx not to use it as character with special meaning (in other words &#8220;B+\G&#8221;). Here is more info on <a href="https://cheatography.com/davechild/cheat-sheets/regular-expressions/" target="_blank" rel="noopener nofollow ugc">regular expressions that describes those characters.</a></p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Vanik		</title>
		<link>https://www.datastudio.ca/functions/how-to-use-the-case-function-in-google-data-studio/#comment-1192</link>

		<dc:creator><![CDATA[Vanik]]></dc:creator>
		<pubDate>Mon, 17 Apr 2023 18:54:50 +0000</pubDate>
		<guid isPermaLink="false">https://datastudio.ca/?p=746#comment-1192</guid>

					<description><![CDATA[Hi 

I have I I have tried using below expression for B+G however doesn’t seem to work 

WHEN REGEXP_MATCH(Campaign, ‘.*(B+G).*’) THEN ‘B+G’ 

However same expression works on using BplusG

Does it have to do with character selection]]></description>
			<content:encoded><![CDATA[<p>Hi </p>
<p>I have I I have tried using below expression for B+G however doesn’t seem to work </p>
<p>WHEN REGEXP_MATCH(Campaign, ‘.*(B+G).*’) THEN ‘B+G’ </p>
<p>However same expression works on using BplusG</p>
<p>Does it have to do with character selection</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Jan		</title>
		<link>https://www.datastudio.ca/functions/how-to-use-the-case-function-in-google-data-studio/#comment-651</link>

		<dc:creator><![CDATA[Jan]]></dc:creator>
		<pubDate>Sat, 12 Feb 2022 01:18:12 +0000</pubDate>
		<guid isPermaLink="false">https://datastudio.ca/?p=746#comment-651</guid>

					<description><![CDATA[Hi,
I am really perplexed by what I thought would be a simple task in Data Studio. I am producing a monthly report of total searches (using the table&#039;s Record Count) for 4 of our websites. No problem. I would like to compare each month&#039;s searches with the previous month and I have been unable to figure out how to do that calculation. I have gotten as far as creating the &quot;1 month prior&quot; date field using this formula: Date(Datetime_sub(PDate, interval 1 Month))

How can I total the searches (using the Record Count field) for this time period?]]></description>
			<content:encoded><![CDATA[<p>Hi,<br />
I am really perplexed by what I thought would be a simple task in Data Studio. I am producing a monthly report of total searches (using the table&#8217;s Record Count) for 4 of our websites. No problem. I would like to compare each month&#8217;s searches with the previous month and I have been unable to figure out how to do that calculation. I have gotten as far as creating the &#8220;1 month prior&#8221; date field using this formula: Date(Datetime_sub(PDate, interval 1 Month))</p>
<p>How can I total the searches (using the Record Count field) for this time period?</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Max		</title>
		<link>https://www.datastudio.ca/functions/how-to-use-the-case-function-in-google-data-studio/#comment-295</link>

		<dc:creator><![CDATA[Max]]></dc:creator>
		<pubDate>Tue, 07 Sep 2021 01:16:05 +0000</pubDate>
		<guid isPermaLink="false">https://datastudio.ca/?p=746#comment-295</guid>

					<description><![CDATA[Hey Great resource and thanks for sharing Lachezar! Have you noticed some ratio metrics crashing when using this grouping method? For example, when I segment campaigns by name on a Google Ads connector, I can aggregate impressions, clicks, and cost, but the table breaks when I add CTR, Conv. Rate, or Avg. cost per click. Any ideas why this might be happening?]]></description>
			<content:encoded><![CDATA[<p>Hey Great resource and thanks for sharing Lachezar! Have you noticed some ratio metrics crashing when using this grouping method? For example, when I segment campaigns by name on a Google Ads connector, I can aggregate impressions, clicks, and cost, but the table breaks when I add CTR, Conv. Rate, or Avg. cost per click. Any ideas why this might be happening?</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Lachezar Arabadzhiev		</title>
		<link>https://www.datastudio.ca/functions/how-to-use-the-case-function-in-google-data-studio/#comment-270</link>

		<dc:creator><![CDATA[Lachezar Arabadzhiev]]></dc:creator>
		<pubDate>Wed, 14 Jul 2021 22:07:09 +0000</pubDate>
		<guid isPermaLink="false">https://datastudio.ca/?p=746#comment-270</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://www.datastudio.ca/functions/how-to-use-the-case-function-in-google-data-studio/#comment-263&quot;&gt;McDealinger&lt;/a&gt;.

Hey McDealinger, thanks for sharing :) I went ahead and posted your question in one of our Data Studio Q&amp;A groups to ask the larger community and here is one suggested solution by user &quot;Anisa Boumrifak&quot;:

-----

Hmm - I doubt this can be done with just one CASE WHEN, even if the syntax was conforming to DS&#039;s expectations. Here comes my take on this, just thoughts though - I have not tried it myself:

1) I would probably use one field F1 for an IF-clausesto handle the time spans and then have 2 CASE WHENs nested in there to get the rules per country and time frame right but without adding the formula, just numbers (25 instead of lead*25).

2) Then maybe F1 need to be used in a second field F2 in an operation such as SUM() so it can be used as a metric () with other metrics - but if we are lucky we don&#039;t have to that extra step

3) Now this field can be either used for a calculation with leads directly or it can be used by blending filtered tables

One would probably have to play around a bit to see if filtering weekends from tables and then blending those tables works better than excluding them in the CASE WHEN...
As stated before: this is just an approach from the top of my head

-----

Hope this helps! ^LA]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://www.datastudio.ca/functions/how-to-use-the-case-function-in-google-data-studio/#comment-263">McDealinger</a>.</p>
<p>Hey McDealinger, thanks for sharing 🙂 I went ahead and posted your question in one of our Data Studio Q&#038;A groups to ask the larger community and here is one suggested solution by user &#8220;Anisa Boumrifak&#8221;:</p>
<p>&#8212;&#8211;</p>
<p>Hmm &#8211; I doubt this can be done with just one CASE WHEN, even if the syntax was conforming to DS&#8217;s expectations. Here comes my take on this, just thoughts though &#8211; I have not tried it myself:</p>
<p>1) I would probably use one field F1 for an IF-clausesto handle the time spans and then have 2 CASE WHENs nested in there to get the rules per country and time frame right but without adding the formula, just numbers (25 instead of lead*25).</p>
<p>2) Then maybe F1 need to be used in a second field F2 in an operation such as SUM() so it can be used as a metric () with other metrics &#8211; but if we are lucky we don&#8217;t have to that extra step</p>
<p>3) Now this field can be either used for a calculation with leads directly or it can be used by blending filtered tables</p>
<p>One would probably have to play around a bit to see if filtering weekends from tables and then blending those tables works better than excluding them in the CASE WHEN&#8230;<br />
As stated before: this is just an approach from the top of my head</p>
<p>&#8212;&#8211;</p>
<p>Hope this helps! ^LA</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: McDealinger		</title>
		<link>https://www.datastudio.ca/functions/how-to-use-the-case-function-in-google-data-studio/#comment-263</link>

		<dc:creator><![CDATA[McDealinger]]></dc:creator>
		<pubDate>Tue, 29 Jun 2021 14:26:56 +0000</pubDate>
		<guid isPermaLink="false">https://datastudio.ca/?p=746#comment-263</guid>

					<description><![CDATA[Uff Guys, you are good. Thanks a lot.
Here is the case where I&#039;m broke my head.
- We have a Guarantee by Countries (DE, US) [Created Field as CRG]
- Each Country has a different Guarantee. [DE=25, US=44]
- This Guarantee could be in dynamic Changes by dates, days converted to numbers.
- Guarantee could be excluded on Weekends from 20210322 for one country, so create the field for each country is not so good. 

And here I&#039;m stuck.

CASE
WHEN (country IN (&quot;Denmark&quot;, &quot;Sweden&quot;) AND CRG IN (&quot;Yes&quot;)) THEN lead*25
WHEN (country IN (&quot;Italy&quot;) AND CRG IN (&quot;Yes&quot;) AND dateWeekends IN (&quot;No&quot;)) THEN lead*20
WHEN (country IN (&quot;Greece&quot;) AND (dateNumber !=20210626) AND (dateNumber !=20210627)) THEN leads*15
ELSE 0
END

The question is.
What is the best way to exclude Weekends after 20210322 and save all data before this date?]]></description>
			<content:encoded><![CDATA[<p>Uff Guys, you are good. Thanks a lot.<br />
Here is the case where I&#8217;m broke my head.<br />
&#8211; We have a Guarantee by Countries (DE, US) [Created Field as CRG]<br />
&#8211; Each Country has a different Guarantee. [DE=25, US=44]<br />
&#8211; This Guarantee could be in dynamic Changes by dates, days converted to numbers.<br />
&#8211; Guarantee could be excluded on Weekends from 20210322 for one country, so create the field for each country is not so good. </p>
<p>And here I&#8217;m stuck.</p>
<p>CASE<br />
WHEN (country IN (&#8220;Denmark&#8221;, &#8220;Sweden&#8221;) AND CRG IN (&#8220;Yes&#8221;)) THEN lead*25<br />
WHEN (country IN (&#8220;Italy&#8221;) AND CRG IN (&#8220;Yes&#8221;) AND dateWeekends IN (&#8220;No&#8221;)) THEN lead*20<br />
WHEN (country IN (&#8220;Greece&#8221;) AND (dateNumber !=20210626) AND (dateNumber !=20210627)) THEN leads*15<br />
ELSE 0<br />
END</p>
<p>The question is.<br />
What is the best way to exclude Weekends after 20210322 and save all data before this date?</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Lachezar Arabadzhiev		</title>
		<link>https://www.datastudio.ca/functions/how-to-use-the-case-function-in-google-data-studio/#comment-193</link>

		<dc:creator><![CDATA[Lachezar Arabadzhiev]]></dc:creator>
		<pubDate>Fri, 12 Feb 2021 18:19:16 +0000</pubDate>
		<guid isPermaLink="false">https://datastudio.ca/?p=746#comment-193</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://www.datastudio.ca/functions/how-to-use-the-case-function-in-google-data-studio/#comment-163&quot;&gt;Keith&lt;/a&gt;.

Hmm... this is an interesting case Keith and thanks for the comprehensive description :) How about using the DATE_DIFF (for compatibility mode) or  DATETIME_DIFF, which will allow you to get the difference between dates in the form of an integer. In that way, then the number is 0, then that will be a match and a first purchase. From there, you can write your CASE in a much easier way ^LA]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://www.datastudio.ca/functions/how-to-use-the-case-function-in-google-data-studio/#comment-163">Keith</a>.</p>
<p>Hmm&#8230; this is an interesting case Keith and thanks for the comprehensive description 🙂 How about using the DATE_DIFF (for compatibility mode) or  DATETIME_DIFF, which will allow you to get the difference between dates in the form of an integer. In that way, then the number is 0, then that will be a match and a first purchase. From there, you can write your CASE in a much easier way ^LA</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Keith		</title>
		<link>https://www.datastudio.ca/functions/how-to-use-the-case-function-in-google-data-studio/#comment-163</link>

		<dc:creator><![CDATA[Keith]]></dc:creator>
		<pubDate>Wed, 20 Jan 2021 18:09:17 +0000</pubDate>
		<guid isPermaLink="false">https://datastudio.ca/?p=746#comment-163</guid>

					<description><![CDATA[Is there any way to write a case statement to say &quot;if data in column A matches data in column B&quot;? The use case is that I have rows where a purchase date is in column A. In column B I have the very first date that person ever purchased something. Column C is a unique identifier for that person. So if person A make five purchases over five months, I don&#039;t have a way of only counting person A as a new purchaser in the first month that they purchased something. My thought is to say &quot;WHEN column A matches column B THEN &#039;Fist Purchase;&quot; In theory, it would only append &quot;First Purchase&quot; on the rows where the purchase date and the first purchase date match, thereby allowing me to count the new purchasers month over month. I just can&#039;t figure out a way to accomplish this. Any help would be greatly appreciated!]]></description>
			<content:encoded><![CDATA[<p>Is there any way to write a case statement to say &#8220;if data in column A matches data in column B&#8221;? The use case is that I have rows where a purchase date is in column A. In column B I have the very first date that person ever purchased something. Column C is a unique identifier for that person. So if person A make five purchases over five months, I don&#8217;t have a way of only counting person A as a new purchaser in the first month that they purchased something. My thought is to say &#8220;WHEN column A matches column B THEN &#8216;Fist Purchase;&#8221; In theory, it would only append &#8220;First Purchase&#8221; on the rows where the purchase date and the first purchase date match, thereby allowing me to count the new purchasers month over month. I just can&#8217;t figure out a way to accomplish this. Any help would be greatly appreciated!</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Lachezar Arabadzhiev		</title>
		<link>https://www.datastudio.ca/functions/how-to-use-the-case-function-in-google-data-studio/#comment-49</link>

		<dc:creator><![CDATA[Lachezar Arabadzhiev]]></dc:creator>
		<pubDate>Sat, 11 Jul 2020 17:14:58 +0000</pubDate>
		<guid isPermaLink="false">https://datastudio.ca/?p=746#comment-49</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://www.datastudio.ca/functions/how-to-use-the-case-function-in-google-data-studio/#comment-48&quot;&gt;Marshal&lt;/a&gt;.

Great to hear it worked out Marshal! :)]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://www.datastudio.ca/functions/how-to-use-the-case-function-in-google-data-studio/#comment-48">Marshal</a>.</p>
<p>Great to hear it worked out Marshal! 🙂</p>
]]></content:encoded>
		
			</item>
	</channel>
</rss>
