<?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 Sandeepsamanth on Medium]]></title>
        <description><![CDATA[Stories by Sandeepsamanth on Medium]]></description>
        <link>https://medium.com/@sandeepsamanth884?source=rss-7a3af999ed2e------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*OggjhqP0Dgh8DyH_</url>
            <title>Stories by Sandeepsamanth on Medium</title>
            <link>https://medium.com/@sandeepsamanth884?source=rss-7a3af999ed2e------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 24 Nov 2026 22:44:41 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@sandeepsamanth884/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[ Mastering Power BI: Real-World DAX Patterns Every Analyst Should Know]]></title>
            <link>https://medium.com/@sandeepsamanth884/mastering-power-bi-real-world-dax-patterns-every-analyst-should-know-031d12d79e0c?source=rss-7a3af999ed2e------2</link>
            <guid isPermaLink="false">https://medium.com/p/031d12d79e0c</guid>
            <category><![CDATA[power-bi-desktop]]></category>
            <category><![CDATA[dax]]></category>
            <dc:creator><![CDATA[Sandeepsamanth]]></dc:creator>
            <pubDate>Sun, 29 Jun 2025 11:18:22 GMT</pubDate>
            <atom:updated>2025-06-29T11:18:22.342Z</atom:updated>
            <content:encoded><![CDATA[<p>Power BI is more than just visuals. It’s a powerful data modeling engine — and at the heart of it lies <strong>DAX (Data Analysis Expressions)</strong>.</p><p>Here’s a curated list of my most commonly used DAX formulas for creating dynamic, scalable dashboards — from beginners to advanced analysts.</p><p>🧩 <strong>Calculated Columns</strong></p><p>📌 Full Name</p><p>Full Name = ‘Customer’[First Name] &amp; “ “ &amp; ‘Customer’[ Last Name]</p><p>📌 <strong>Age Breakdown (Categorical Binning)</strong></p><pre>CopyEditAge Breakdown = <br>IF(&#39;Customer&#39;[Age] &gt;= 55, &quot;55+&quot;,<br>IF(&#39;Customer&#39;[Age] &gt;= 45, &quot;45-54&quot;,<br>IF(&#39;Customer&#39;[Age] &gt;= 35, &quot;35-44&quot;,<br>IF(&#39;Customer&#39;[Age] &gt;= 25, &quot;25-34&quot;,<br>&quot;18-24&quot;) ) )</pre><p>📌 <strong>Month-Year Format</strong></p><pre>Month Year = FORMAT(&#39;Date&#39;[Date], &quot;mm-yyyy&quot;)</pre><p>📌 <strong>Composite Key (for mapping or lookups)</strong></p><pre>Temperature Key = <br>RELATED(&#39;Sales Territory&#39;[Sales Territory Region]) &amp; RELATED(&#39;Date&#39;[Month Number Of Year])</pre><p>📌 <strong>Last Order Date</strong></p><pre>Last Order Date = MAXX(RELATEDTABLE(&#39;Fact Sales&#39;), &#39;Fact Sales&#39;[Order Date])</pre><h3>📈 Core Measures</h3><p>📌 <strong>Base Measures</strong></p><pre>Total Sales = SUM(&#39;Fact Sales&#39;[Sales Amount])<br>Total Costs = SUM(&#39;Fact Sales&#39;[Total Product Cost])<br>Total Quantity = SUM(&#39;Fact Sales&#39;[Order Quantity])<br>Total Orders = DISTINCTCOUNT(&#39;Fact Sales&#39;[Sales Order Number])<br>Total Profit = [Total Sales] - [Total Costs]<br>Profit Margin = DIVIDE([Total Profit], [Total Sales])</pre><p>📌 <strong>Region-Level Aggregation</strong></p><pre>Region Sales = SUMX(RELATEDTABLE(&#39;Fact Sales&#39;), &#39;Fact Sales&#39;[Sales Amount])</pre><p>📌 <strong>Transaction Banding</strong></p><pre>Region Sales Volume = <br>SWITCH(TRUE(),<br>    [Total Transactions] &gt;= 3000000, &quot;High Volume&quot;,<br>    [Total Transactions] &gt;= 1000000, &quot;Medium Volume&quot;,<br>    [Total Transactions] &gt; 0, &quot;Low Volume&quot;,<br>    &quot;N/A&quot;)</pre><h3>🔁 Dynamic Context with CALCULATE()</h3><p>📌 <strong>Total Sales Ignoring Country Filters</strong></p><pre>Total Sales (All Countries) = <br>CALCULATE([Total Sales], ALL(&#39;Sales Territory&#39;[Sales Territory Country]))</pre><p>📌 <strong>Percent of Total Sales</strong></p><pre>% of Total Sales = <br>DIVIDE([Total Sales], [Total Sales (All Countries)])</pre><p>📌 <strong>Sales for Specific Country or Region</strong></p><pre>Total Sales (US) = <br>CALCULATE([Total Sales], &#39;Sales Territory&#39;[Sales Territory Country] = &quot;United States&quot;)</pre><pre>Total Sales (North America) = <br>CALCULATE([Total Sales],<br>    &#39;Sales Territory&#39;[Sales Territory Country] IN { &quot;United States&quot;, &quot;Canada&quot; })</pre><p>📌 <strong>Total Sales for a Year</strong></p><pre>Total Sales (2024) = <br>CALCULATE([Total Sales], &#39;Date&#39;[Year] = 2024)</pre><p>📌 <strong>Optional: Handle blanks</strong></p><pre>Total Sales (US) = <br>IF([Total Sales] = BLANK(), BLANK(),<br>    CALCULATE([Total Sales],<br>    &#39;Sales Territory&#39;[Sales Territory Country] = &quot;United States&quot;))</pre><h3>⏳ Time Intelligence Patterns</h3><p>📌 <strong>Year-to-Date (YTD) Sales</strong></p><pre>Total Sales YTD = TOTALYTD([Total Sales], &#39;Date&#39;[Date])</pre><p>📌 <strong>Fiscal YTD (e.g., ending on June 30)</strong></p><pre>Fiscal YTD Sales = TOTALYTD([Total Sales], &#39;Date&#39;[Date], &quot;06/30&quot;)</pre><p>📌 <strong>Prior Year Sales</strong></p><pre>Prior Year Sales = CALCULATE([Total Sales], DATEADD(&#39;Date&#39;[Date], -1, YEAR))</pre><p>📌 <strong>Prior Year YTD Sales</strong></p><pre>Total Sales YTD PY = CALCULATE([Total Sales YTD], DATEADD(&#39;Date&#39;[Date], -1, YEAR))</pre><p>📌 <strong>Previous Month Sales</strong></p><pre>Total Sales PM = CALCULATE([Total Sales], DATEADD(&#39;Date&#39;[Date], -1, MONTH))</pre><p>📌 <strong>Month-over-Month Growth (%)</strong></p><pre>Total Sales MOM Growth % = <br>DIVIDE([Total Sales] - [Total Sales PM], [Total Sales PM])</pre><h3>🏁 Wrapping Up</h3><p>DAX is the language that makes Power BI truly <strong>dynamic</strong> and <strong>interactive</strong>. From row-level calculations to context-sensitive time intelligence, these building blocks allow you to build <strong>smarter</strong>, <strong>faster</strong>, and <strong>cleaner</strong> dashboards.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=031d12d79e0c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[General Kafka Concepts and Questions]]></title>
            <link>https://medium.com/@sandeepsamanth884/general-kafka-concepts-and-questions-347a83389c95?source=rss-7a3af999ed2e------2</link>
            <guid isPermaLink="false">https://medium.com/p/347a83389c95</guid>
            <category><![CDATA[kafka]]></category>
            <dc:creator><![CDATA[Sandeepsamanth]]></dc:creator>
            <pubDate>Wed, 25 Sep 2024 18:23:56 GMT</pubDate>
            <atom:updated>2024-09-25T18:23:56.909Z</atom:updated>
            <content:encoded><![CDATA[<ol><li><strong>What is Apache Kafka — — -</strong>A distributed streaming platform for building real-time data pipelines and streaming applications. It is designed for high throughput and fault tolerance.</li><li><strong>What are the main components of Kafka?</strong></li></ol><ul><li><strong>Producers</strong>: Applications that send messages to Kafka topics.</li><li><strong>Consumers</strong>: Applications that read messages from Kafka topics.</li><li><strong>Brokers</strong>: Kafka servers that store and serve messages.</li><li><strong>Topics</strong>: Categories or feeds to which messages are published.</li><li><strong>Partitions</strong>: Sub-divisions of topics that enable parallel processing.</li><li><strong>Consumer Groups</strong>: A group of consumers that work together to consume messages from a topic.</li></ul><p><strong>What is a Kafka topic and how is it structured?</strong></p><ul><li>A topic is a stream of messages categorized under a unique name. Each topic can be divided into multiple partitions.</li></ul><p><strong>What is the difference between a topic and a partition?</strong></p><ul><li>A topic is a logical grouping of messages, while partitions are the physical divisions within a topic that allow for parallel processing.</li></ul><h3>Data Flow and Architecture</h3><p><strong>-How does data flow in Kafka? — — -</strong>Producers send data to topics, which are divided into partitions. Consumers read from these partitions, and data can be replicated across multiple brokers for fault tolerance.</p><p><strong>-Explain the write and read process in Kafka.</strong></p><ul><li><strong>Write Process</strong>: Producers send messages to a topic partition. The broker appends the message to the partition log and acknowledges receipt based on the configured acknowledgment settings.</li><li><strong>Read Process</strong>: Consumers pull messages from a topic partition based on their offset. Each consumer maintains its own offset for tracking.</li></ul><h3>Configuration and Performance</h3><p><strong>What are some important Kafka configuration properties?</strong></p><ul><li><strong>acks</strong>: Determines the number of acknowledgments required from the broker.</li><li><strong>replication.factor</strong>: Number of copies of a partition across brokers.</li><li><strong>linger.ms</strong>: Time to wait before sending a batch of messages.</li><li><strong>buffer.memory</strong>: Memory allocated for buffering messages.</li></ul><p><strong>-How do you achieve high throughput in Kafka?</strong></p><ul><li>By increasing the number of partitions, optimizing batch sizes, using asynchronous producers, and configuring appropriate replication settings.</li></ul><h3>Reliability and Durability</h3><p><strong>How does Kafka ensure message durability?</strong></p><ul><li>Messages are written to disk and can be replicated across multiple brokers. This allows data to be available even if some brokers fail.</li></ul><p><strong>-What are acknowledgments in Kafka, and what are the different types?</strong></p><ul><li><strong>acks=0</strong>: No acknowledgment is required.</li><li><strong>acks=1</strong>: Leader broker acknowledges the receipt.</li><li><strong>acks=all</strong>: All replicas must acknowledge receipt.</li></ul><h3>Consumer and Producer Mechanics</h3><p><strong>-What is the role of a consumer group?</strong></p><ul><li>A consumer group allows multiple consumers to share the workload of consuming messages from a topic. Each message is processed by only one consumer in the group.</li></ul><p><strong>-How can you ensure message ordering in Kafka?</strong></p><ul><li>By using the same key for related messages, which ensures that they are sent to the same partition, maintaining order.</li></ul><h3>Error Handling and Backpressure</h3><p><strong>-How do you handle errors in Kafka?</strong></p><ul><li>By implementing error handling strategies like retry policies, dead-letter topics, and logging errors for monitoring.</li></ul><p><strong>-What is backpressure in Kafka, and how do you handle it?</strong></p><ul><li>Backpressure occurs when the consumer cannot keep up with the producer’s rate. It can be handled by monitoring consumer lag and adjusting producer throughput or consumer capacity.</li></ul><h3>Monitoring and Maintenance</h3><p><strong>-How do you monitor a Kafka cluster?</strong></p><ul><li>By using monitoring tools like Prometheus and Grafana to track metrics such as throughput, consumer lag, broker health, and partition distribution.</li></ul><p><strong>-What tools can you use to manage Kafka?</strong></p><ul><li><strong>Kafka Manager</strong>: A web-based tool for managing Kafka clusters.</li><li><strong>Confluent Control Center</strong>: A comprehensive management and monitoring tool provided by Confluent.</li></ul><h3>Advanced Topics</h3><p><strong>-What is Kafka Streams?</strong></p><ul><li>A client library for building applications and microservices that process data in real-time using Kafka. It provides features for stream processing, stateful computations, and windowing.</li></ul><p><strong>-Explain the difference between Kafka and traditional message brokers.</strong></p><ul><li>Kafka is designed for high throughput and scalability, supports stream processing natively, and allows for fault-tolerant storage, whereas traditional message brokers often focus on message delivery with less emphasis on data persistence.</li></ul><p><strong>-What is KRaft (Kafka Raft)?</strong></p><ul><li>A mode of Kafka that removes the dependency on Zookeeper by using the Raft consensus algorithm for metadata management.</li></ul><h3>Security</h3><p><strong>-What security features does Kafka provide?</strong></p><ul><li>Kafka supports authentication (SASL), encryption (SSL), and authorization (ACLs) to secure communication and access.</li></ul><p><strong>-How can you implement ACLs in Kafka?</strong></p><ul><li>By using the Kafka command-line tools to create and manage access control lists for topics, consumer groups, and other resources.</li></ul><h3>SCENARIO BASED</h3><h3>1. Handling Duplicate Messages</h3><p><strong>Question:</strong> You are processing financial transactions through Kafka, and you discover that some transactions are being duplicated. How would you handle this issue?</p><p><strong>Answer:</strong> To handle duplicate messages, I would implement idempotent producers. This feature ensures that even if the same message is sent multiple times, it is only recorded once in the topic. I would also maintain a unique identifier for each transaction (like a transaction ID) and implement deduplication logic in the consumer. This could involve checking previously processed transaction IDs against a datastore to ensure each transaction is only processed once.</p><h3>2. Consumer Lag Monitoring</h3><p><strong>Question:</strong> Your consumer group is experiencing high lag, and you’re receiving alerts. Describe the steps you would take to diagnose and resolve the issue.</p><p><strong>Answer:</strong> First, I would monitor metrics such as the rate of incoming messages (produced) versus the rate of messages processed (consumed) to identify the source of the lag. I would check the distribution of partitions across consumers to ensure they are balanced. It’s also important to review consumer configuration parameters like max.poll.records and fetch.min.bytes. If necessary, I might consider scaling up the number of consumers or increasing the number of partitions to improve processing speed.</p><h3>3. Data Loss During Broker Failures</h3><p><strong>Question:</strong> Imagine that a broker fails and your replication factor is set to 1. What steps would you take to mitigate data loss in this situation?</p><p><strong>Answer:</strong> To mitigate data loss, I would immediately increase the replication factor for critical topics to at least 2 or 3, ensuring that data is replicated across multiple brokers. I would also implement monitoring and alerting for broker health to identify failures promptly. In the future, I would use a higher replication factor for all critical topics from the outset, alongside regular backups of the Kafka logs.</p><h3>4. Message Ordering Challenges</h3><p><strong>Question:</strong> You have a requirement that certain events must be processed in the order they are received. How would you ensure that ordering is maintained when using multiple partitions?</p><p><strong>Answer:</strong> To maintain message ordering, I would use a consistent key for related messages (e.g., user ID, order ID) so that all messages with the same key are sent to the same partition. This ensures that they are processed in the order they are produced. While this approach can limit scalability, it is essential for use cases requiring strict ordering.</p><h3>5. Schema Evolution</h3><p><strong>Question:</strong> You need to update the Avro schema for a Kafka topic without downtime. How would you approach schema evolution while ensuring backward compatibility?</p><p><strong>Answer:</strong> I would follow the principles of backward and forward compatibility in Avro schema evolution. This includes adding new fields with default values to avoid breaking existing consumers, ensuring that changes do not affect consumers using the older schema. Before rolling out the new schema, I would test it in a staging environment with both old and new consumers to validate compatibility.</p><h3>6. Consumer Group Rebalancing</h3><p><strong>Question:</strong> During a consumer group rebalance, your consumers are experiencing delays in processing messages. What might be causing this, and how would you mitigate it?</p><p><strong>Answer:</strong> Delays during rebalancing could be due to partition reassignment or the need for consumers to catch up on their offsets. To mitigate this, I would ensure that consumers are appropriately configured with adequate resources to minimize processing delays. Additionally, I would adjust the session.timeout.ms and heartbeat.interval.ms settings to reduce the frequency of rebalances and keep consumer groups stable.</p><h3>7. End-to-End Latency</h3><p><strong>Question:</strong> You notice that your end-to-end latency is higher than expected. How would you analyze and optimize this latency?</p><p><strong>Answer:</strong> I would start by profiling each component of the data pipeline, including the producer (checking batch sizes and acks settings), the Kafka brokers (examining network latency and broker performance), and the consumer (monitoring processing logic and polling intervals). Based on the analysis, I might increase batch sizes for the producer, optimize consumer processing logic, or scale the number of partitions and consumers to improve overall throughput and reduce latency.</p><h3>8. Mixing Different Data Formats</h3><p><strong>Question:</strong> You need to support multiple data formats (JSON, Avro) for different consumers. How would you implement a solution that efficiently manages this in Kafka?</p><p><strong>Answer:</strong> I would implement different serializers and deserializers based on the data format for producers and consumers. For instance, JSON producers would use a JsonSerializer, while Avro consumers would use an AvroDeserializer. Additionally, I would consider using a Schema Registry to manage schemas for Avro data, ensuring that all consumers can understand the message formats correctly. It’s crucial to establish a clear contract on the expected format between producers and consumers.</p><h3>9. Scaling Kafka Consumers</h3><p><strong>Question:</strong> Your application’s load has increased significantly, and you need to scale your consumers. What considerations would you take into account before scaling?</p><p><strong>Answer:</strong> Before scaling consumers, I would evaluate the number of partitions in the topic, as each partition can be consumed by only one consumer in a group at a time. If there are fewer partitions than consumers, scaling won’t help. I would consider increasing the number of partitions to allow for more consumers, ensuring that the processing load is evenly distributed. Additionally, I’d review consumer configurations to ensure they can handle increased load efficiently.</p><h3>10. Rolling Upgrades</h3><p><strong>Question:</strong> You need to perform a rolling upgrade on your Kafka cluster. What steps would you take to ensure there’s no disruption in service?</p><p><strong>Answer:</strong> I would start by planning the upgrade during a low-traffic period and ensure that all components (producers, consumers, and brokers) are compatible with the new version. I would upgrade brokers one at a time, monitoring their health and ensuring that they can still serve requests before moving on to the next broker. During the upgrade, I would closely monitor consumer lag and ensure that data continues to flow smoothly, verifying that producers can still send messages and consumers can read them without interruption.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=347a83389c95" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>