<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Sneha Naik on Medium]]></title>
        <description><![CDATA[Stories by Sneha Naik on Medium]]></description>
        <link>https://medium.com/@sneha_naik?source=rss-1022dfb6aa83------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*UhbXNd2YibAe7Zbv.jpg</url>
            <title>Stories by Sneha Naik on Medium</title>
            <link>https://medium.com/@sneha_naik?source=rss-1022dfb6aa83------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 21 Nov 2026 10:11:08 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@sneha_naik/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Tableau — Merge Rows to Columns with a Delimiter]]></title>
            <link>https://medium.com/@sneha_naik/tableau-merge-rows-to-columns-with-a-delimiter-29638022fda2?source=rss-1022dfb6aa83------2</link>
            <guid isPermaLink="false">https://medium.com/p/29638022fda2</guid>
            <category><![CDATA[tableau]]></category>
            <dc:creator><![CDATA[Sneha Naik]]></dc:creator>
            <pubDate>Thu, 23 Jul 2020 05:25:10 GMT</pubDate>
            <atom:updated>2020-07-23T05:26:41.334Z</atom:updated>
            <content:encoded><![CDATA[<p>Today’s story is based on a requirement at work. As always, let’s lean on to our friendly — neighborhood — samplesupertore.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/276/1*-Apx8P64X6WJtT4HZTdrwg.png" /><figcaption>Category and it’s sub-categories</figcaption></figure><p>We know every category has a number of sub-categories. But, we’d like to display every sub-category for a category in a single row.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/613/1*fRg2srshOxO5s0Uh0pZxiQ.png" /></figure><p>Below are the steps to get to it, first add Category and Sub-Category to rows, then:<br>1. Create a field [Sub-Categories]</p><pre>if INDEX()=1<br>THEN<br>attr([Sub-Category])<br>ELSE<br>PREVIOUS_VALUE(attr([Sub-Category]))+’, ‘+ attr([Sub-Category])<br>end</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/293/1*eOwA2hbno0ltTVP9462VYg.png" /><figcaption>Edit table calculation to restart for every category</figcaption></figure><p>2. Rank each of the rows from Step 1. And Edit table Calc same as step 1. Name it [Rank Appened Rows]</p><pre>RANK_UNIQUE([Sub-Categories])</pre><p>Add both to the rows and you will see a view like the one below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/847/1*DbI_BAz49b-DS0eDjNYggA.png" /></figure><p>What we need is the last partition in each category so filter for [Rank Appened Rows] = 1 and voila !</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/744/1*VGyUp3iRcGptbUwr-EttwA.png" /></figure><p>Other References:<br><a href="http://tableaugurus.blogspot.com/2016/02/CombiningSeperateRowsintoSingleRowList.html">http://tableaugurus.blogspot.com/2016/02/CombiningSeperateRowsintoSingleRowList.html</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=29638022fda2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Adding a Thousand separator in Tableau using REG_EXP]]></title>
            <link>https://medium.com/@sneha_naik/adding-a-thousand-separator-in-tableau-using-reg-exp-c84d29e10122?source=rss-1022dfb6aa83------2</link>
            <guid isPermaLink="false">https://medium.com/p/c84d29e10122</guid>
            <category><![CDATA[tableau-training]]></category>
            <category><![CDATA[tableau-numbers]]></category>
            <category><![CDATA[tableau-consultant]]></category>
            <category><![CDATA[tableau]]></category>
            <dc:creator><![CDATA[Sneha Naik]]></dc:creator>
            <pubDate>Mon, 13 Jan 2020 04:32:05 GMT</pubDate>
            <atom:updated>2020-01-13T04:32:05.896Z</atom:updated>
            <content:encoded><![CDATA[<p>Haven’t we run into this case? I’d say occasionally for me. Cause I mostly change the data type to Int and then format it from here</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/478/1*CNXfxYX4Wa8NkDWleJNdwQ.png" /></figure><p><strong>Scenario:<br></strong>While switching between the below 3 metrics change the display to match. Which meant the common data type to handle the 3 metrics is str .</p><ul><li>Sales — $xx,yxy</li><li>Profit Ratio — xy.yx%</li><li>Items per Order — xx.x</li></ul><p>Data set: Super Store</p><p><strong>Formulas :</strong></p><ul><li>Sales<br>“$”+REGEXP_REPLACE(STR(round(sum([Sales]))),”(\d)(?=(\d{3}))”,”$0,”)</li><li>Profit Ratio<br>Str(round(([Profit Ratio])*100,2)) + ‘%’</li><li>Items per Order<br>str(round(FLOAT([Items Per Order]),1))</li></ul><p>You can check out the workbook <a href="https://public.tableau.com/views/JanWeek22020_DynamicBarChart/WOW2020WEEK2?:display_count=y&amp;:origin=viz_share_link"><strong>here</strong></a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c84d29e10122" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Tableau: LOD play with Dates — Part 1]]></title>
            <link>https://medium.com/@sneha_naik/tableau-lod-play-with-dates-part-1-ba31c0848f78?source=rss-1022dfb6aa83------2</link>
            <guid isPermaLink="false">https://medium.com/p/ba31c0848f78</guid>
            <category><![CDATA[data-visualization]]></category>
            <dc:creator><![CDATA[Sneha Naik]]></dc:creator>
            <pubDate>Thu, 02 May 2019 23:30:48 GMT</pubDate>
            <atom:updated>2019-05-02T23:31:31.794Z</atom:updated>
            <content:encoded><![CDATA[<h3>Tableau: LOD play with Dates — Part 1</h3><p>Dates are almost tricky with tableau. Especially when you need continuous dates for a Quarter of your interest.</p><p>I’ve been working on the #workoutwednesday challenge for Week 18, 2019 set by the maestro of LODs Ann Jackson.</p><p>You can find the challenge <a href="http://www.workout-wednesday.com/2019-week-18-lets-compare-quarterly-sales-performance/">here</a>.</p><p>Part 1 of the post I will take you over the seeming easy looking line chart.</p><h3>The requirements are:</h3><ol><li>2 selector to choose two quarters to compare.</li><li>The latest quarter comes in top axes and the older quarter goes to the bottom axes dynamically.</li><li>You color code the two lines according to step 2.</li></ol><p>I first did the following:</p><p>I extracted the quarter value from Order Date(Right click Order Date&gt; Custom Date &gt; Select Quarter from Drop Down). Named it Order Date(Quarter). [Keep this saved, we will use it for the actual implementation]</p><ol><li>Added Order Date(Quarter) Date dimension to the filter shelf to allow users to select a quarter</li><li>Order Date(continuous exact date to columns)</li><li>Running total of Sum(Sales)<br>(See screenshot below)</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uVfDnlzWf8LJvAxx0jMZtQ.png" /><figcaption>Warming up to the Challenge</figcaption></figure><p>Now, this would not work when we need two selectors to compare like the requirement.</p><p>Let’s divide this into smaller requirements.<br>1. Two-quarter selectors that generate the dates for our line graph<br>2. Order the two line graphs based on which is the latest quarter</p><h3>Two selectors that generate the dates for our line graph</h3><ol><li>Create two Parameters from the Order Date(Quarters) dimension we created earlier and name them as you wish. I named them [1.Quarters Parameter] and [2.Quarters Parameter].<br>If you are having trouble with the display format of Q1 2015, try using <strong><em>“Q”q YYYY </em></strong>in custom format. This worked for me.</li><li>Create a conditional metric like below where you are looking for Quarters from Order based on your selection.</li></ol><pre>[Order Date (Quarters)] = [1.Quarters Parameter]<br>OR <br>[Order Date (Quarters)] = [2.Quarters Parameter]</pre><p>3. Add this to your <strong>Context filter</strong> as we would need our calculation to take place on top of the data filtered based on the quarter selections. Select True.</p><p>4. We now need to generate all the Dates for the Quarters we select. To do that we first need to identify the No. of Days Between Order Date and Order Date(Quarter). Call it <strong><em>Days b/w</em></strong></p><pre>DATEDIFF(&#39;day&#39;,[Order Date (Quarters)],[Order Date])</pre><p>Add this to the row as Dimension along with Order Date, Order Date(Quarter) and DATETRUNC(‘day’, [Order Date (Quarters)]) to see data generated.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pMAuDV8wTauoXqy7d8KY2g.png" /><figcaption>No. of Days in each Quarter</figcaption></figure><p>You will see that each quarter runs until 89 days. We will use this to add with the start date of each quarter to generate all the dates in the quarter we select.</p><p>5. For example, if you select Q3 2018 and Q4 2018 we want the start dates as July 1st,2018 and October 1st, 2018. <br>To identify the latest quarter start date use below formula</p><pre>{MIN([Order Date (Quarters)])}</pre><p>For the older quarter starter, we will use the below formula</p><pre>{MAX([Order Date (Quarters)])}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8JcvLEZRIKSzZx44UiwSnw.png" /><figcaption>Start Dates for Both Quarters</figcaption></figure><p>To generate all the dates for the latest and older quarter use below formulas.<br><strong><em>Days in Quarter Old</em></strong></p><pre>{MIN([Order Date (Quarters)])}+[Days b/w]</pre><p><strong><em>Days in Quarter New</em></strong></p><pre>{MAX([Order Date (Quarters)])}+[Days b/w]</pre><p>Adding all the above to your report you will see that all the dates in your quarter are populated for the 89 days in it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Rl7wq15h0Lmfru4kImgmag.png" /><figcaption>Dates in Quarters Selected</figcaption></figure><p>Now, rearrange your report to obtain the line graphs by adding sum(sales) and enabling running total. Add Attr(Order Date) to the detail to see the quarters.</p><p>6. Now we Color Code the Lines</p><pre>IF [Order Date (Quarters)]=[1.Quarters Parameter]<br>AND [1.Quarters Parameter]&gt;=[2.Quarters Parameter]<br>THEN TRUE<br>ELSEIF [Order Date (Quarters)]=[2.Quarters Parameter]<br>AND [2.Quarters Parameter]&gt;=[1.Quarters Parameter]<br>THEN TRUE<br>ELSE FALSE<br>END</pre><p>Add this to the color shelf and <strong><em>sort</em></strong> manually to True at the Top and False at the bottom.</p><p>And now you have the dynamic changing quarter comparison line chart.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zbbKk2ZwfLbO3Jxi6Kp50g.png" /><figcaption>Final Line chart</figcaption></figure><p>Part 2 coming up next for which I need to start working on the rest of the challenge. See you there.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ba31c0848f78" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Tableau Date Filtering Using LOOKUP Shows No Data]]></title>
            <link>https://medium.com/@sneha_naik/tableau-date-filtering-using-lookup-shows-no-data-fdc64cbdc59b?source=rss-1022dfb6aa83------2</link>
            <guid isPermaLink="false">https://medium.com/p/fdc64cbdc59b</guid>
            <category><![CDATA[tableau]]></category>
            <dc:creator><![CDATA[Sneha Naik]]></dc:creator>
            <pubDate>Wed, 27 Mar 2019 06:54:09 GMT</pubDate>
            <atom:updated>2019-03-27T06:54:09.686Z</atom:updated>
            <content:encoded><![CDATA[<p>Date Filters, is that spread on your sandwich. You’ve gotta have it. Occassionally, you dont!</p><p>If you happen to use LOOKUP() in your report along with a date filter, you are going to observe that the data goes <em>null</em> when you select Dates other than <em>ALL</em> . The solution for this by Tableau is available at this <a href="https://kb.tableau.com/articles/howto/date-filtering-using-lookup-shows-no-data"><em>link</em></a>.</p><p>However, I’d like to elaborate with an example.</p><p>Let’s take YoY %Diff of Sales v/s MMM/YYYY. Pretty straight forward with tableau giving you a one click option. (Right click Sales &gt; Quick Table Calculations &gt; YoY Growth). The layout would look like below , along with the year filter (with <em>All</em> selected)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/880/0*MqmpO6Ab11Tc7Nn0.jpg" /></figure><p>Now, try selecting one of the years, and the layout just vanishes. See below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/880/0*2lsRB3kYqwjGZilX.png" /></figure><p>So, why does this happen you ask ? Table calculations — in our case : LOOKUP() ,needs to have all of the data in the view to work because it is referencing that data in other cells to make its calculation. But, when you apply the date filter the reference isn’t available anymore.</p><p>The Workaround : <strong><em>Dynamic Hiding</em></strong> Create a table calculation to replicate the data and then filter on this new Table Calculation.</p><p><em>Formula</em> : LOOKUP(YEAR(MIN([Order Date])),0)</p><p>Turn this to discrete and create your filter. Remove the thousandths place by changing number format.To remove the 2010, add filter Sales&lt;&gt;Null in the filter shelf.</p><p>The Final layout is as below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/880/0*31ulUm1NjlGCW1CX.png" /></figure><p>Reference: Brandon Shonk</p><p><a href="https://dev.to/">dev.to</a> is a social network for software developers. <a href="https://dev.to/acoh3n/how-to-make-the-most-out-of-devto-ag0">Lean more</a> <br> (open source and free forever ❤️)</p><p><em>Originally published at </em><a href="https://dev.to/sneha27j/tableau-date-filtering-using-lookup-shows-no-data-1n7"><em>dev.to</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fdc64cbdc59b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Tableau: Cohort Analysis]]></title>
            <link>https://medium.com/@sneha_naik/tableau-cohort-analysis-d2b0727c633?source=rss-1022dfb6aa83------2</link>
            <guid isPermaLink="false">https://medium.com/p/d2b0727c633</guid>
            <category><![CDATA[data-visualization]]></category>
            <category><![CDATA[tableau]]></category>
            <dc:creator><![CDATA[Sneha Naik]]></dc:creator>
            <pubDate>Wed, 27 Mar 2019 06:51:25 GMT</pubDate>
            <atom:updated>2019-03-27T06:51:25.608Z</atom:updated>
            <content:encoded><![CDATA[<p>Today, my brain melted. Reason: I took on the #workoutwednesday challenge for week 12. The link to the challenge is below:<br><a href="http://www.workout-wednesday.com/2019-week-12-customer-retention/">http://www.workout-wednesday.com/2019-week-12-customer-retention/</a><br>I insist you give it a try.</p><p>Customer retention is an interesting way for your client/business to understand if more customers are sticking around. Do you need to tweak your promotional offers/incentives? Because acquiring new customers can be more expensive, not that you should stop!</p><p>I’m going to be detailing how to get this cohort analysis graph now.</p><p>Step 1. ‘12’ Week Filter<br>a. Create Week(Order Date) Parameter call it [Week of Order]<br>b. Create Week Number from 0 to 12 using below formula:<br>DATEDIFF(‘week’,[Week of Order],DATETRUNC(‘week’, [Order Date]))<br>c. Create Week No. bin for ‘b.’ . This to ensure Week 0 to 12 is populated even there is no data. Call this [Week Number Bin].</p><p>Step 2. Create Cohort Week<br>a. Cohort Week = DATETRUNC(‘week’, [Week of Order])</p><p>Step 3. Pull in Customers from Cohort Week<br>[Week-Order Date] = [Week of Order]<br>Where [Week-Order Date] is the same Order Date that is the superstore data set but rolled up to week</p><p>Step 4. Identify Customers from Cohort Week in weeks 1 to 12. <br>{ FIXED [Customer Name] : MAX([Customers from Cohort Week])}<br>Call it ‘Retained Customers’.</p><p>Step 5. Add COUNTD(CustomerName) to columns. Add [Week Number Bin] to rows and you have the base ready.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oWUrdYFcmBbbREaG912fKQ.png" /></figure><p>I’ll leave the rest to you guys, to figure out.</p><p>Find my Viz. here : <a href="https://public.tableau.com/views/12WeekCustomerRetention/Week122019?:embed=y&amp;:display_count=yes">https://public.tableau.com/views/12WeekCustomerRetention/Week122019?:embed=y&amp;:display_count=yes</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d2b0727c633" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Tableau: Waterfall Viz.]]></title>
            <link>https://medium.com/@sneha_naik/tableau-waterfall-viz-a5ea00b60f70?source=rss-1022dfb6aa83------2</link>
            <guid isPermaLink="false">https://medium.com/p/a5ea00b60f70</guid>
            <category><![CDATA[tableau]]></category>
            <category><![CDATA[data-visualization]]></category>
            <dc:creator><![CDATA[Sneha Naik]]></dc:creator>
            <pubDate>Sat, 23 Mar 2019 00:54:11 GMT</pubDate>
            <atom:updated>2019-03-23T02:34:01.506Z</atom:updated>
            <content:encoded><![CDATA[<p>I wanted to brush up on some new ways to showcase data and what better way than picking up a challenge from Work out Wednesday. I went back in time to Week 48 from 2018 and picked up the ‘Profitability Bridge’.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/998/1*dkn_3Id4DZMAzbqDr4sjNQ.png" /></figure><p>Looks pretty straight forward! Looks can also be deceiving ;)</p><p>I’m going to talk exclusively about Adding dashed lines that “connect” each bar.</p><p>To do that you need to enable reference lines, right? But when you tried, did it connect like in the challenge?</p><p>Add sum(sales) and Previous Value for sum(Sales) value to column and enable dual axis for Previous Value for sum(Sales) value, using the below formula:</p><p>IF FIRST() = 0<br>THEN 0 <br>ELSE LOOKUP(RUNNING_SUM(SUM([Sales])),-1) <br>END</p><p>After enabling dual axis, add a reference line for Previous value and sum(sales) per cell. and voila you can see those connecting lines.</p><p>You can find the challenge here: <a href="http://www.workout-wednesday.com/week-48-profitability-bridge/">http://www.workout-wednesday.com/week-48-profitability-bridge/</a></p><p>My visualizations are here: <a href="https://public.tableau.com/profile/snehanaik">https://public.tableau.com/profile/snehanaik</a></p><p>Let me know your thoughts! cheers.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a5ea00b60f70" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Tableau: Normalising Dates for time series alignment]]></title>
            <link>https://medium.com/@sneha_naik/tableau-normalising-dates-for-time-series-alignment-ca59af91346b?source=rss-1022dfb6aa83------2</link>
            <guid isPermaLink="false">https://medium.com/p/ca59af91346b</guid>
            <category><![CDATA[tableau-training]]></category>
            <category><![CDATA[tableau]]></category>
            <category><![CDATA[data-visualization]]></category>
            <dc:creator><![CDATA[Sneha Naik]]></dc:creator>
            <pubDate>Fri, 15 Mar 2019 07:47:08 GMT</pubDate>
            <atom:updated>2019-03-15T07:47:08.028Z</atom:updated>
            <content:encoded><![CDATA[<p>Today, I’d like to discuss Normalising Dates to align your time series graph.</p><p>The example for today is a list of Companies since the 1960s till the present day with their adjusted closing price.</p><p><strong>Default View</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/880/0*KicM6NH_fbXN3Wnd.png" /></figure><p>When you drag Date(year) to columns, Adjusted closing price to rows and company in the detail shelf, tableau and select the time series graph you’d have a graph that look’s like the screenshot above. Now, if you want to create a graph that aligns all the companies start date to the same date below are the steps.</p><p><strong>Normalized View</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/880/0*cwvqf6DnPhKotBDM.png" /></figure><p>a. Find the min. Date for each company using LOD.<br><strong><em>formula</em></strong> : {FIXED [Company] : min(Date-Year)}<br>b. Find the min. Date for entire data set using LOD.<br><strong><em>formula</em></strong> : {min(Date-Year)}<br>c. Find the difference of year b/w step a. and b. <br>Let’s call this <em>Diff. Years</em><br>d. Use ‘Diff. Years’ from Step c to adjust Company dates.<br><strong><em>formula</em></strong> : [Date-Year] — Diff. Years<br>Let’s call this <em>Normalised Dates</em><br>e. Drag Normalised Dates to Columns, Adjusted Closing Price to rows and Company to detail shelf.</p><p>Do let me know your thoughts/questions/suggestions. I’d be happy to hear them.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ca59af91346b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Tableau Date Filtering Using LOOKUP Shows No Data]]></title>
            <link>https://medium.com/@sneha_naik/tableau-date-filtering-using-lookup-shows-no-data-16e87395f315?source=rss-1022dfb6aa83------2</link>
            <guid isPermaLink="false">https://medium.com/p/16e87395f315</guid>
            <category><![CDATA[tableau]]></category>
            <dc:creator><![CDATA[Sneha Naik]]></dc:creator>
            <pubDate>Fri, 15 Mar 2019 07:42:57 GMT</pubDate>
            <atom:updated>2019-03-15T07:42:57.670Z</atom:updated>
            <content:encoded><![CDATA[<p>Date Filters is that spread on your sandwich. You’ve gotta have it. Occasionally, you don&#39;t!</p><p>If you happen to use LOOKUP() in your report along with a date filter, you are going to observe that the data goes <em>null</em> when you select Dates other than <em>ALL</em>. The solution for this by Tableau is available at this <a href="https://kb.tableau.com/articles/howto/date-filtering-using-lookup-shows-no-data"><em>link</em></a>.</p><p>However, I’d like to elaborate with an example.</p><p>Let’s take YoY %Diff of Sales v/s MMM/YYYY. Pretty straight forward with tableau giving you a one-click option. (Right-click Sales &gt; Quick Table Calculations &gt; YoY Growth). The layout would look like below, along with the year filter (with <em>All</em> selected)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/880/0*nSP1qYApUs7dCHFM.jpg" /></figure><p>Now, try selecting one of the years, and the layout just vanishes. See below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/880/0*4CGheFSX63SeOVM2.png" /></figure><p>So, why does this happen you ask ? Table calculations — in our case : LOOKUP(), needs to have all of the data in the view to work because it is referencing that data in other cells to make its calculation. But, when you apply the date filter the reference isn’t available anymore.</p><p>The Workaround: <strong><em>Dynamic Hiding</em></strong><br>Create a table calculation to replicate the data and then filter on this new Table Calculation.<br><em>Formula</em> : LOOKUP(YEAR(MIN([Order Date])),0)<br>Turn this to discrete and create your filter. Remove the thousandths place by changing the number format. To remove 2010, add filter Sales&lt;&gt;Null in the filter shelf.</p><p>The Final layout is as below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/880/0*cMZvoYuH2UmbLg0-.png" /></figure><p>Reference: Brandon Shonk</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=16e87395f315" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Tableau: Assume Referential Integrity]]></title>
            <link>https://medium.com/@sneha_naik/tableau-assume-referential-integrity-cbd150f51dd6?source=rss-1022dfb6aa83------2</link>
            <guid isPermaLink="false">https://medium.com/p/cbd150f51dd6</guid>
            <category><![CDATA[tableau]]></category>
            <dc:creator><![CDATA[Sneha Naik]]></dc:creator>
            <pubDate>Wed, 13 Mar 2019 20:35:53 GMT</pubDate>
            <atom:updated>2020-07-23T04:36:35.263Z</atom:updated>
            <content:encoded><![CDATA[<p>This is one of those tableau options you want to keep in your back pocket. If your dashboard uses multi-table inner joins, and your data has referential integrity (PK and FK) defined but your database isn’t enforcing it, switching on the ‘Assume Referential Integrity’ might do the trick for you with dashboard performance.</p><p>Let’s try with an example.</p><p>songs_event is a table that captures all the songs that are streamed on a platform by song_id , date and user_id.</p><p>songs_lkp is a table that stores details about each and every song. The attributes here are song_id,song_desc,artist.</p><p>All the song_ids from the songs_event table are available in the songs_lkp table. When the two tables are joined you end up with a view like below.</p><p>Now, if you are required to build a view on how many songs are heard per day your query can look like below:</p><p>select count(sevn.song_id),sevn.date<br>from songs_event sevn<br>inner join songs_lkp slkp<br>on sevn.song_id = slkp.song_id<br>group by sevn.date</p><p>By selecting ‘Assume Referential Integrity’ you’re confirming tableau that for this join, for every record from songs_event there is a matching record in songs_lkp. And that is true, you will not need songs_lkp to ascertain the count of songs/day.</p><p>Tableau will simplify the query to as below. This will return a faster result because we’ve removed an unnecessary join.</p><p>select count(sevn.song_id),sevn.date from songs_event sevn</p><p>Note:</p><ol><li>This option works only for Inner Joins.</li></ol><p>2. Doesn’t work for Single-table Data source</p><p>3. Enable this Tableau feature only when you’re sure there is a PK/FK relationship between your tables. Else, this could lead to unreliable results.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cbd150f51dd6" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>