<?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 Mansi Srivastava on Medium]]></title>
        <description><![CDATA[Stories by Mansi Srivastava on Medium]]></description>
        <link>https://medium.com/@mansi.srivastava_77881?source=rss-6876c61b5e0b------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*9a0IFbHkP0D3EtcO</url>
            <title>Stories by Mansi Srivastava on Medium</title>
            <link>https://medium.com/@mansi.srivastava_77881?source=rss-6876c61b5e0b------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 08:47:06 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@mansi.srivastava_77881/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[Custom Geographic Hierarchy for any Country in Looker]]></title>
            <link>https://blog.searce.com/custom-geographic-hierarchy-for-any-country-in-looker-2f03a578c136?source=rss-6876c61b5e0b------2</link>
            <guid isPermaLink="false">https://medium.com/p/2f03a578c136</guid>
            <category><![CDATA[maps]]></category>
            <category><![CDATA[countryregion]]></category>
            <category><![CDATA[looker]]></category>
            <category><![CDATA[heirarchy]]></category>
            <category><![CDATA[custom-map]]></category>
            <dc:creator><![CDATA[Mansi Srivastava]]></dc:creator>
            <pubDate>Mon, 09 Oct 2023 13:04:31 GMT</pubDate>
            <atom:updated>2023-10-12T11:35:10.682Z</atom:updated>
            <content:encoded><![CDATA[<p>Geographic data plays a crucial role in any BI tool for the visualization of data based on spatial distribution. Interactive maps take data visualization and analysis to the next level by allowing users to actively engage with geographic data and gain real-time insights. It allows users to drill down from higher-level geographic views (e.g., world or country) to more detailed views (e.g., region, city) with a simple click. This facilitates a hierarchical analysis of data.</p><p>BI tools typically offer drill-down functionality for standard political boundaries. However, Looker can also allow one to customize division of countries into regions (e.g., north-zone, south-zone) for comparison on the same map. Looker provides a dynamic mapping experience, displaying data from country to city/district/village levels and enabling custom geographical groupings based on available geo files. For instance, it can map specific parts of a country to user-defined regions like the East region.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*cvwxJs3GXD-ZuOSb" /></figure><p>If you’ve worked on Looker before, you already know the limitations developers face while using pre-built map layers in Looker.</p><ol><li>The pre-built layers are specific to US and UK regions; for any other country in the world, one needs to build a custom map layer using a topoJSON or GeoJSON file.</li><li>One can only drill down from the highest hierarchy in your map file, drilling up, i.e. combining the highest hierarchy into regions and zones is not possible directly.</li></ol><p>Let’s handle one limitation at a time.</p><h3><strong>1. Building Custom Map Layer for any geographic region in the world</strong></h3><h4><strong>Prerequisites:</strong></h4><ol><li>TopoJSON or GeoJSON file for the required Country/Region.</li><li>A table which has at least one column defining your geographic data in proper capitalisation.</li></ol><p>By proper capitalisation I mean the syntax of the name of the regions in your data should match with that in the topojson/geojson file, since data is plotted to the map layer in a case-sensitive fashion.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*F9r6wmfVXG6jOITZtOXM0A.png" /></figure><p>Hence, if the data has a region name in a different format, developers need to configure the name string in the required format.</p><p>Once our data is ready, let’s move forward to actually build the custom map layer.</p><h4><strong>Building custom map-layer</strong></h4><p>Creating a custom map-layer is easy if no segmentation is needed or if you have a shapefile with desired regional geography.</p><ol><li>Drag and drop your topojson/geojson file into the project folder in looker.</li></ol><p><em>#For best practices, one should create a separate folder to keep all the topojson/geojson files at one place.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TD8UAXyz3EBZlP3L5D-kFA.png" /></figure><p>2. Add the map_layer parameter in the model file defining the location of the map using either the name of a file or a URL.</p><p><em>For more information on available parameters in map_layer, refer to the </em><a href="https://cloud.google.com/looker/docs/reference/param-model-map-layer#specifying_a_map_layer"><em>documentation</em></a><em>.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*e0kgyvK4_GAWdAVt" /></figure><p>3. Updating the view containing your geographic data using <em>map_layer_name</em>. In our case, the dimension defining the state names is<em> state_format</em>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0wCJ6zqAHd64ExtfaLypyw.png" /></figure><p>That’s it!</p><p>We are all set to explore our data on the customized map_layer we just added.</p><h4><strong>Exploring the newly added map-layer</strong></h4><p>While creating a Look on Explore, add the dimension with the map_layer linked to it, and the measure as per requirement and run the query. Select visualization as any map-type of your choice and requirement. (Google maps, Static Map (Regions), Map (Legacy), etc.)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*lqQ-3cHs-xD2S3It" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*gSEvn9lWPOrkGCNH" /></figure><p>Now let’s get our hands dirty and dig into how to visualize custom segmentation of the geographic data.</p><h3><strong>2. Visualising custom segmentation of geographic data</strong></h3><h4><strong>Prerequisites:</strong></h4><ol><li>TopoJSON or GeoJSON file for the required Country/Region, obviously.</li><li>Business Logic defining which region/zone contains what geographic region.</li></ol><h4><strong>Understanding the concept:</strong></h4><p>Topojson/GeoJson files are nothing but a variation of json files containing specific key-value pairs for geographic data.</p><p>For better understanding, let’s see how a topojson/geojson file looks like in tabular format.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*OkwJOa0lN3R3kaAC" /></figure><p>The JSON file outlines boundary coordinates for the smallest division (e.g., districts) and broader divisions like states and countries. It proposes categorizing states into regions (e.g., Gujarat to WEST, Haryana to NORTH), drawing an analogy to how employees belong to specific departments in a company. The goal is to structure the JSON file accordingly.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*8QjKHapFJHFTkpJ7" /></figure><h4><strong>Creating modified topojson/geojson file:</strong></h4><p>There are several ways to alter our shapefile to something similar to the above table.</p><ol><li><strong>Manual Labour</strong>: Convert shapefile to CSV, manually edit in sheets by adding a new column and mapping values to regions. (Suitable for coarse granularity with fewer rows, like country-level data.)</li><li><strong>Creating metadata mapping:</strong> Define a metadata or legend table describing regional data and merge/join it with the original shapefile using SQL tools (e.g., BigQuery).</li></ol><p>I. Create a metadata table based on the highest geographic data granularity.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mB7iKnFwsOWtwXu9NI_4Dw.png" /></figure><p>II. Merge this table and the topojson file using a common column. (<br>You can convert both files in csv and merge them using by SQL tool For eg: BigQuery)</p><p>The final table after joining looks like this.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*R7jNlOBsqbqxvF-CrxuDlQ.png" /><figcaption>The new field “Region” is mapped successfully.</figcaption></figure><p>III. Save the results and convert it back to topojson/geojson using online converters.</p><h4><strong>Attaching the topojson/geojson file in Looker:</strong></h4><p>The process of attaching the shape-file in models and views is similar to creating a normal custom may_layer explained above.</p><ol><li>Add map_layer in the model file with the new topojson/geojson file.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*2QHaDzHwTZUKTv9s" /></figure><p>2. Link this map_layer in the dimension defining regions in the concerned view.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/815/0*eDeD_kXWKN8EMZk-" /></figure><p>The final resultant maps look like this:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2F9pcwrM6IlfQ%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3D9pcwrM6IlfQ&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2F9pcwrM6IlfQ%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/9c8c538e34cd11858a9202fc04cd002d/href">https://medium.com/media/9c8c538e34cd11858a9202fc04cd002d/href</a></iframe><p><strong>Additional Notes:</strong></p><ol><li>Match JSON file to finest geographic data granularity (e.g., districts). It enables combining coordinates seamlessly. For drill-in functionality, ensure JSON matches desired granularity.</li><li>Metadata table should align with the highest geographic data granularity (e.g., state names for regional data).</li><li>If you have your geographic data in any other format, like shapefile, CSV, KML, WKT, etc., you can convert them into geojson or topojson easily by using any online converter tool. Some of the onlive converter tools are listed below.</li></ol><ul><li><a href="http://geojson.io/#new&amp;map=2/0/20">geojson.io | powered by Mapbox</a></li><li><a href="https://mygeodata.cloud/converter/">Online GIS/CAD Data Converter | SHP, KML, KMZ, TAB, CSV, ...</a></li></ul><p>4. Huge Topojson/Geojson files increase latency in loading custom maps in Looker. It is recommended to have smaller size files (&lt;1 MB) for faster map loads in Looker.</p><p>5. Developers need to be creative in case of mismatch in string format of their data and topojson string format.</p><p>6. Getting the needed shapefile can be challenging. Paid services or GIS tools like QGIS and ARCGIS help create custom topojson files, if proficient in using them.</p><p>7. To specify the default map layer in Looker, use the property_key parameter with map_layer in the model file. If not specified, Looker uses the first matching field. Create a distinct map layer with the appropriate property_key to link the correct field (e.g., district names) to the corresponding dimension in Looker for better accuracy.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*xv_vAw0UfhMnY2TF" /></figure><p>8. In case one needs partial geography, Map specific states to regions, leaving others blank. Null fields won’t display on the map.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/688/1*RZOHeHtWASfZ_f3jVHH3UQ.png" /></figure><p>Phew! That was a lot to process. Hope this article could provide some guidance to work with Maps in Looker. Harness this potential, visualize with precision, and let the maps in Looker guide your path toward data-driven success. Happy mapping!</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2FN6YkmfQBeEEjLDcoDl%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2FN6YkmfQBeEEjLDcoDl%2Fgiphy.gif&amp;image=https%3A%2F%2Fi.giphy.com%2Fmedia%2FN6YkmfQBeEEjLDcoDl%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="244" frameborder="0" scrolling="no"><a href="https://medium.com/media/0aa3905a2b43b72b2c85683760c216fd/href">https://medium.com/media/0aa3905a2b43b72b2c85683760c216fd/href</a></iframe><p>References:</p><p><a href="https://cloud.google.com/looker/docs/google-map-options">https://cloud.google.com/looker/docs/google-map-options</a></p><p><a href="https://cloud.google.com/looker/docs/map-regions-options">https://cloud.google.com/looker/docs/map-regions-options</a></p><p><a href="https://cloud.google.com/looker/docs/reference/param-model-map-layer">https://cloud.google.com/looker/docs/reference/param-model-map-layer</a></p><p><a href="https://medium.com/google-cloud/custom-maps-in-looker-1c2e103496df">https://medium.com/google-cloud/custom-maps-in-looker-1c2e103496df</a></p><p><a href="https://cloud.google.com/looker/docs/best-practices/how-to-create-custom-map-regions#:~:text=To%20import%20the%20region%20data,code%20in%20a%20LookML%20project">https://cloud.google.com/looker/docs/best-practices/how-to-create-custom-map-regions#:~:text=To%20import%20the%20region%20data,code%20in%20a%20LookML%20project</a>.</p><p><a href="https://www.googlecloudcommunity.com/gc/Technical-Tips-Tricks/What-is-the-property-key-with-respect-to-TopoJSON/ta-p/592129#:~:text=The%20property_key%20parameter%20chooses%20which,the%20property_key%20is%20case%20mismatched">https://www.googlecloudcommunity.com/gc/Technical-Tips-Tricks/What-is-the-property-key-with-respect-to-TopoJSON/ta-p/592129#:~:text=The%20property_key%20parameter%20chooses%20which,the%20property_key%20is%20case%20mismatched</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2f03a578c136" width="1" height="1" alt=""><hr><p><a href="https://blog.searce.com/custom-geographic-hierarchy-for-any-country-in-looker-2f03a578c136">Custom Geographic Hierarchy for any Country in Looker</a> was originally published in <a href="https://blog.searce.com/">Searce</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Period Over Period Analysis in Qlik Sense]]></title>
            <link>https://blog.searce.com/period-over-period-analysis-in-qlik-sense-bf9ebe22d8a5?source=rss-6876c61b5e0b------2</link>
            <guid isPermaLink="false">https://medium.com/p/bf9ebe22d8a5</guid>
            <category><![CDATA[period-over-period]]></category>
            <category><![CDATA[business-intelligence]]></category>
            <category><![CDATA[data-analytics]]></category>
            <category><![CDATA[till-date-analysis]]></category>
            <category><![CDATA[qlik-sense]]></category>
            <dc:creator><![CDATA[Mansi Srivastava]]></dc:creator>
            <pubDate>Fri, 17 Feb 2023 07:42:32 GMT</pubDate>
            <atom:updated>2023-02-17T08:50:18.425Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3iWaJPWJI0ZWFBO8fVA61Q.png" /></figure><p><strong>Business Case:</strong></p><p>Very often in many business use cases, we need our reports and dashboards to show the most recent data instead of historical data. But many times, in order to compare the organization’s growth over the years, we need to include the flexibility of till-date or period-over-period analysis in the reports.</p><p>Till date analysis gives the users the flexibility to view and generate reports using data within the specific date range of their choice without hardcoding the dates. Most common types of till-date analysis include month-till-date(MLT), quarter-till-date(QTD) and year-till-date(YTD).</p><p>Period-over-period is analysis that measures something in the present and compares it to the same measurement in a comparable period of time in the past. The goal is to adjust the slice of the past you are looking at, so the same amount of time has passed in the two periods you are comparing.</p><p><strong>Data Scenario:</strong></p><p>If the user’s selected date of analysis is 15.08.2023, the ranges of data used for calculation with respect to date range choice would be as follows:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*F7Wh26yE94yXkNgHJpj9mg.png" /></figure><p>Now once we’ve got the gist of what till-date analysis is, let us see how we can achieve this Qlik Sense.</p><p>If one is familiar with Qlik Sense, you might already know that till-date analysis features are not predefined in the tool. Hence, customized code of the same is needed.</p><p><strong>Data Snapshot:</strong></p><p>The date dimension is <em>OrderDate </em>and measure to be calculated is sum(<em>Sales).</em></p><figure><img alt="Data Snapshot" src="https://cdn-images-1.medium.com/max/559/0*yhZMVLK5Kzo9ZtQ_" /></figure><h3><strong>Technical Steps:</strong></h3><h3><strong>Method A: Using Flags</strong></h3><p>In case the developer is not familiar or comfortable with set analysis, he can create flags as master dimension and further use this dimension in visualization for comparative analysis.</p><p>Let’s break writing MDT and LMTD using flags in steps.</p><ol><li>For the date range for MTD, our start date becomes <em>MonthStart(Today())</em> and end date becomes <em>Today().</em></li><li>Using the function<em> AddMonth()</em>, we subtract one month from the date range mentioned above to get the date range for LMTD. i.e. <em>MonthStart(AddMonth(Today(),-1)), </em>and <em>AddMonth(Today(),-1)</em> respectively.</li><li>Applying <em>if_expression </em>with proper flags and conditions, we get our final expression</li></ol><blockquote>=If(OrderDate&gt;MonthStart(Today()) and OrderDate&lt;Today(), ‘Current month’, if(OrderDate&gt;MonthStart(Addmonths(Today(),-1)) and OrderDate&lt;Addmonths(Today(),-1), ‘Previous month’ ,NULL()))</blockquote><p>After saving this expression in Master Dimension, developers can use this in combination with any measure to create comparative charts. For example, if the user wants to see the sum of Sales with respect to Monthly comparative analysis, it would look something like this.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/439/0*S8nyjTgt7BPqpTlV" /></figure><p><strong>Points to note before using this method:</strong></p><ol><li>Make sure to check out “Include null values” in the Data tab where you add this dimension.</li><li>Developers can use this method for hard coded dates instead of Today. Just replace<em> Today()</em> with proper dates in correct syntax in a single quote. (eg <em>‘04/30/1998</em>’).</li><li>Developers can also define these flags as separate measures (replacing string values like “Current month” and “Previous month” with numeric flags like 0 or 1) and use them in aggregate functions to build KPIs.</li></ol><p><strong>Disadvantage of using this method:</strong></p><ol><li>This can only be used for hard coded and Today’s date.</li><li>It does not give the user the flexibility to choose dates of their requirement, i.e. Dynamic Selection is not possible.</li><li>If your data is old, Today() will give date ranges out of your data, hence your report can fail to fetch any results.</li></ol><h3><strong>Method B: Set Analysis</strong></h3><p>Set Analysis covers all the disadvantages of the previous method. It gives developers flexibility to develop reports using hard coded dates, current date as well as Dynamic selection by the user.</p><p>A set expression consists of a combination of the following parts:</p><ul><li><strong>Identifiers.</strong> Identifiers tell us how to handle selection.</li></ul><p><strong><em>A.</em></strong><em> {1}</em> : Represents the full set of <em>All The Records</em> in the application, irrespective of any selections made.</p><p><strong><em>B. </em></strong><em>{$} </em>: Represents the records of the <em>Current Selection</em></p><p><strong><em>C.</em></strong><em> {$1}</em> : Represents the <em>Previous Selection</em>.</p><p>In the screenshot below, the Current Selection is Year <em>1996</em> and Previous Selection was Year <em>1998</em>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*XR7MCD43r7mndejL" /></figure><p>For a complete list of Identifiers, refer <a href="https://help.qlik.com/en-US/sense/November2022/Subsystems/Hub/Content/Sense_Hub/ChartFunctions/SetAnalysis/set-identifiers.htm">here</a>.</p><ul><li><strong>Operators</strong>: (+,-,*,/)Operators are used to include, exclude, or intersect parts of or whole data sets. For example:</li></ul><p><em>sum( {1 — $} Sales ) </em>: Returns sum of sales of the discarding selections.</p><p><em>sum({$*Bookmark} Sales) </em>: Returns sales for elements that are common in the bookmark and current selection.</p><p>For the below snapshot,</p><p>Bookmark selection :<em>“Alfreds Futterkiste” </em>, <em>“Ana Trujilo Emparedados helados”</em></p><p>Current Selection : <em>“Alfreds Futterkiste”</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/855/0*lFgR_jiTG9xLSlEY" /></figure><ul><li><strong>Modifiers:</strong> are synonymous with filter expression. Enclosed in angular brackets &lt;&gt;, we write our filter conditions in proper syntax.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/701/0*oqjdHK5aqDfJd_cX" /></figure><h4>1. Set Analysis with hardcoded date or current date</h4><p>Taking the same example from the previous method, let us write a set expression for the sum of sales for the current month.</p><ol><li>Since we want to include the dates selected in filters, we add $ before the start date (<em>$(=MonthStart(Today()))) </em>and end date (<em>$(=Today())</em>)</li><li>Similar to the flag method, combining all the elements, our final MTD set expression becomes:</li></ol><blockquote>Sum({$&lt;OrderDate={“&gt;=$(=MonthStart(Today()))&lt;=$(=Today())”}&gt;} Sales )</blockquote><p>3. Similarly for LMTD,</p><blockquote>Sum({$&lt;OrderDate={“&gt;=$(=MonthStart(AddMonths(Today(),-1)))&lt;=$(=AddMonths(Today(),-1))”}&gt;} Sales )</blockquote><p>We can build KPIs comparing fields over current and previous directly in the charts.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*VLGuiUh3hgwuaNKp" /></figure><p>Or if you can show percent change from previous month till date in one KPI:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/503/0*mHCChToqF0DFH5Cf" /></figure><h4>2. Set Analysis with Dynamic Date</h4><p>Finally, the most important use case of this date analysis is to make date selection dynamic.</p><p>To achieve this, all we need to do is replace Today() with max(OrderDate).</p><blockquote>Sum({$&lt;OrderDate={“&gt;=$(=MonthStart(max(OrderDate)))&lt;=$(=max(OrderDate))”}&gt;} Sales )</blockquote><p>This approach will:</p><ol><li>Allows users to select dates dynamically.</li><li>If the user accidentally selects two dates, the report will not fail but show calculations based on the later of the two selected dates.</li><li>If initially no selection is made, or data is very old, it will by default show the last entered date in your dataset, instead of null reports.</li></ol><p>Refer the screenshot below to see change of calculations when no selection is made vs when a date is selected. Note that the max(Date), even without selection, is older than today’s date.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/692/0*Bt43SpYlT1CaFCOJ" /><figcaption><strong>Sum(Sales) when no selection applied</strong></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/748/0*GpO1pwrHrG5zkfa5" /><figcaption><strong>Sum(Sales) when a date is selected</strong></figcaption></figure><p><strong>Disadvantages of using set analysis method:</strong></p><ol><li>The re-usability of set expression is lower than the flag method. Since set expressions define one aggregation at a time, one needs to write different expressions for aggregating different measures separately.</li><li>Set expressions can be difficult to write and understand if the complexity increases, especially if they are not from a technical background.</li></ol><p><strong>Conclusion:</strong></p><p>There is more than one way to achieve PoP in Qliksense, based on the developers compatibility with Set analysis, he can use either of the two methods mentioned above.</p><p><strong>References:</strong></p><p><a href="https://help.qlik.com/en-US/sense/November2022/Subsystems/Hub/Content/Sense_Hub/ChartFunctions/SetAnalysis/set-identifiers.htm#:~:text=A%20set%20identifier%20represents%20a,selection%20from%20an%20alternate%20state">https://help.qlik.com/en-US/sense/November2022/Subsystems/Hub/Content/Sense_Hub/ChartFunctions/SetAnalysis/set-identifiers.htm#:~:text=A%20set%20identifier%20represents%20a,selection%20from%20an%20alternate%20state</a>.</p><p><a href="https://help.qlik.com/en-US/qlikview/May2022/Subsystems/Client/Content/QV_QlikView/ChartFunctions/SetAnalysis/set-modifiers.htm#:~:text=A%20set%20can%20be%20modified,%2CRegion%3D%7BUS%7D%3E">https://help.qlik.com/en-US/qlikview/May2022/Subsystems/Client/Content/QV_QlikView/ChartFunctions/SetAnalysis/set-modifiers.htm#:~:text=A%20set%20can%20be%20modified,%2CRegion%3D%7BUS%7D%3E</a>.</p><p><a href="https://help.qlik.com/en-US/sense/November2022/Subsystems/Hub/Content/Sense_Hub/ChartFunctions/SetAnalysis/set-operators.htm">https://help.qlik.com/en-US/sense/November2022/Subsystems/Hub/Content/Sense_Hub/ChartFunctions/SetAnalysis/set-operators.htm</a></p><p><a href="https://www.analyticsvidhya.com/blog/2014/01/set-analysis-qlikview/">https://www.analyticsvidhya.com/blog/2014/01/set-analysis-qlikview/</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bf9ebe22d8a5" width="1" height="1" alt=""><hr><p><a href="https://blog.searce.com/period-over-period-analysis-in-qlik-sense-bf9ebe22d8a5">Period Over Period Analysis in Qlik Sense</a> was originally published in <a href="https://blog.searce.com/">Searce</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Blend Aggregated/Non-Aggregated KPIs in Looker Studio]]></title>
            <link>https://blog.searce.com/blend-aggregated-non-aggregated-kpis-in-looker-studio-bd403dfada98?source=rss-6876c61b5e0b------2</link>
            <guid isPermaLink="false">https://medium.com/p/bd403dfada98</guid>
            <category><![CDATA[looker-studio]]></category>
            <category><![CDATA[gcp]]></category>
            <category><![CDATA[data-analytics]]></category>
            <category><![CDATA[error]]></category>
            <category><![CDATA[blending]]></category>
            <dc:creator><![CDATA[Mansi Srivastava]]></dc:creator>
            <pubDate>Mon, 28 Nov 2022 05:44:12 GMT</pubDate>
            <atom:updated>2022-11-28T06:25:57.053Z</atom:updated>
            <content:encoded><![CDATA[<p>Most of the time, while using any data analytics tool, the fields already present in the data source alone might not be enough to analyze the data correctly. Hence one needs to derive new fields from the given data to give a more meaningful analysis.</p><p>For example, the client has a dataset that contains the quantity of goods sold and the sales price per item. But as a manufacturer, the client might be more interested to see an overview of the business’s revenue (quantity x SP per item) generated.</p><p>These Derived or Calculated fields let users extend and transform the information flowing from their data sources and derive smarter insights. Users can perform many arithmetic aggregations in Looker Studio, modify text and date formats, and use custom logic to create a branch field. However, it has limitations around combining several aggregation types in calculated fields. In this article, we will explore solutions to such business scenarios.</p><p>Before we jump in, one needs to know and understand the concept of <em>aggregation</em> and <em>blending</em> in Looker Studio.</p><p>Aggregation is the process of reducing and summarizing tabular data. In Looker Studio, aggregation always takes place in the context of a set of dimensions, be it all the dimensions in the dataset, just a subset, or even an empty set which lets the user visualize the summary of the dataset. Few of the pre-calculated aggregations provided by Looker studio are Sum, Average, Max, Min, Auto(non-editable), Count, Count Distinct etc. Aggregations can be applied at data source level, chart level, or in calculated fields.</p><p>The function <em>Blend Data</em> is synonymous with joins in SQL. In Looker Studio, users can join tables without actually writing the code and using the blend editor to configure the joins (type of join : left, right, etc., join conditions, fields to be added to blended data, etc. ). Simply put, it combines tables from multiple data sources and stores them as one table.</p><p>As of this article’s publishing date, Looker Studio does not support re-aggregating the already aggregated fields and mixing metric(aggregated value) and dimension (non-aggregated value) in one calculation logic.</p><p>Here is where blends come in handy.</p><h3>Error type 1: Re-aggregating metrics is not supported</h3><p>Taking a hypothetical situation, the client has an e-commerce dataset containing order information like <em>Order_Id, Customer_Name, Customer_Id, Sales, Profit, Product_Category, Sub_Category, City, Country, Order_Date</em>, etc.</p><p>The developer of the project needs a table showing total Orders from each City, therefore, creating an aggregated calculated field that counts the number of orders.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*0CGtCp0xK2O9RnMD" /></figure><p>Using a calculated field, a table displaying all the cities and their order counts, i.e., <em>City </em>as a dimension and <em>order_count</em> as a metric can be created. (Refer to the table shown below)</p><p>Now, if the client wants to display the maximum orders coming from one City, he’ll need to extract a maximum of the record counts from <em>order_count</em> field of this table. The simplest way would be to use the MAX operator.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*BrRp0t-Zm99S2Bc3" /></figure><p>But Looker Studio throws an error on trying to aggregate an already-aggregated field. It throws a similar error when you try to use any other aggregation operation SUM(), COUNT(), AVG(), DIV(), etc. It makes sense because internally, the operation performed is similar to MAX(COUNT(<em>Order_Id</em>)) GROUP BY <em>City</em>, since <em>order_count</em>=COUNT(<em>Order_Id</em>).</p><p>The higher precedence of logic inside calculated fields makes this query illogical since the grouping happens after the fields are calculated. Therefore, we need to disguise the calculated field as a regular field to manipulate the order of precedence.</p><p>This is where blending comes to the rescue. If we blend this table with any dummy table with <em>City</em> as join condition, Looker Studio will treat all the fields in the final blended table as regular fields.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*WdpNGE1oyBu4gmEt" /></figure><p>Notice how in the data source, Order_count is depicted by a blue symbol, signifying this is an aggregated field, whereas, in blended data, it changes to green, showing this is a regular field.</p><p>Looker studio would not throw any error if one tries to calculate the max orders in any city using MAX() function with blended data.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/977/0*qA4P6UJ83Irdj1no" /></figure><h3>Error type 2: Invalid Input Expression — Aggregated and non-aggregated fields cannot be mixed in a Boolean Expression.</h3><p>Assume that a client wants to add a column to a table that displays if the customer has bought more than 5 items of the same category.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*jlBQmSN5uKfi1V0C" /></figure><p>Using dimensions or non-aggregate fields with aggregate in a Boolean expression is not allowed in Looker Studio.</p><p>Similar to the previous error, we need to camouflage the aggregate field as a regular field by blending and creating a new joint table. Thus blending the above table with a dummy table with <em>customer_name</em> as the join key should give us the desired results.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*xT6DcrdxQUB24Oua" /></figure><p>Using blended data as the source data, it is now possible to use both aggregation and dimension field types in a Boolean expression.</p><h3>Error Type 3: Calculated fields can’t mix metrics (aggregated values) and dimensions (non-aggregated values)</h3><p>This error is similar to error type 2, except this occurs when instead of using an aggregated field, we create an aggregation in the calculation logic itself.</p><p>Consider the following table:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*anxna-wWBUmwzxtQ" /></figure><p>This table shows the granular level details for every <em>order_id, </em>but the client also wants to see the total sales made in each category in addition to individual order sales in the same table. If the developer tries to create a new column that sums the sales category-wise, Looker Studio will throw an error like this.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*9YDrVsyQ5anPWKb1" /></figure><p>Although <em>Sales</em> is not an aggregated field, but since an aggregation function is used in the calculation logic, it acts like one. So, how to solve this error, where one not only needs the fields of this table but also need to derive a new calculated column? Again using blend tables.</p><p>Instead of blending with a dummy table, the user needs to create another meaningful table that resembles the data we need. For instance, in this example, we need a table that already shows the total sum of sales grouped by category, something similar to this table.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/945/0*HawYcemvN1iZavUU" /></figure><p>Therefore, we blend/join the two tables above with the join condition on <em>the Category</em> field. This will result in a table with both individual sales per order id and total sales per category.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*OM4R2-32JRca80JR" /></figure><h3>Limitations:</h3><p>Although blending can fix some errors, it has its limitations.</p><ol><li>Looker Studio allows blending a maximum of 5 tables or visuals.</li><li>Once you create a blend, you cannot add/create data source level calculated fields. Chart-level calculated fields are still permissible.</li><li>Blends do not give you the flexibility to change the data format. For example, if the resultant blend table has a column that has numbers with two decimal precision, you cannot increase or decrease it.</li><li>Since blend is just another name for joins, many blends can create a lot of new tables, making your dashboard heavy and less functional.</li><li>Tables are only blended or joined on an equity condition, i.e., greater than, less than, not equal to, etc., are not available.</li></ol><p><strong>Conclusion:</strong></p><p><strong>So there you have a custom approach to solve aggregation mix errors for use cases implemented using Looker Studio.</strong></p><p><strong>References:</strong></p><p><a href="https://support.google.com/looker-studio/answer/9320174?hl=en"><strong>https://support.google.com/looker-studio/answer/9320174?hl=en</strong></a></p><p><a href="https://support.google.com/datastudio/answer/9061420?hl=en"><strong>https://support.google.com/datastudio/answer/9061420?hl=en</strong></a></p><p><a href="https://support.google.com/looker-studio/answer/6299685?hl=en#zippy=%2Cin-this-article"><strong>https://support.google.com/looker-studio/answer/6299685?hl=en#zippy=%2Cin-this-article</strong></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bd403dfada98" width="1" height="1" alt=""><hr><p><a href="https://blog.searce.com/blend-aggregated-non-aggregated-kpis-in-looker-studio-bd403dfada98">Blend Aggregated/Non-Aggregated KPIs in Looker Studio</a> was originally published in <a href="https://blog.searce.com/">Searce</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>