Data Analytics
111K subscribers
223 photos
1 video
2 files
950 links
Perfect channel to learn Data Analytics

Learn SQL, Python, Alteryx, Tableau, Power BI and many more

For Promotions: @coderfun @love_data
Download Telegram
This is much easier to maintain than repeatedly writing [Total Sales].

๐Ÿ”น 12. Best Practices

When writing complex DAX:
โœ” Give variables meaningful names
โœ” Break complicated calculations into logical steps
โœ” Avoid repeating the same expression
โœ” Use RETURN for the final result
โœ” Keep business logic readable
โœ” Use variables to make debugging easier

Avoid meaningless names such as VAR X =...
Prefer VAR TotalSales =...

Clear names make your DAX easier for another analyst to understand.

๐ŸŽฏ Interview Questions

1๏ธโƒฃ What is VAR in DAX?
VAR creates a temporary variable that stores a value or table expression during calculation.

2๏ธโƒฃ What does RETURN do?
It specifies the final expression that the measure should return.

3๏ธโƒฃ Are DAX variables stored permanently in the model?
No. Variables exist only during the evaluation of the expression.

4๏ธโƒฃ Why should you use variables?
They improve readability, reduce repeated calculations, and make complex DAX easier to debug.

5๏ธโƒฃ Can a DAX variable contain a table?
Yes. A variable can store either a scalar value or a table expression.

๐Ÿงช PRACTICE

Create these measures using VAR:
โœ” Total Profit
โœ” Profit Margin
โœ” Sales Target Status
โœ” Sales Performance
โœ” Selected Region Message

Then try to rewrite one of your older complex DAX measures using variables.

๐Ÿ’ก Double Tap โค๏ธ For More
โค3๐Ÿ‘1
๐Ÿ“Š Data Analyst Interview Series โ€” Part 1

Guys, let's start a Data Analyst Interview Series where I'll cover the most important questions that are commonly asked in Data Analyst interviews.

I'll cover SQL, Excel, Power BI, Python, statistics, data cleaning, case studies, business questions, and scenario-based questions.

Let's start with the basics ๐Ÿ‘‡

1๏ธโƒฃ Tell me about yourself.

Sample Answer:

"I'm a Data Analyst with experience working with SQL, Excel, Power BI, Python, and data visualization. My work involves extracting and transforming data, analyzing business problems, building dashboards, and automating repetitive reporting processes. I focus not just on creating reports, but on understanding the business requirement and converting data into actionable insights."

2๏ธโƒฃ What does a Data Analyst do?

Sample Answer:

"A Data Analyst collects, cleans, transforms, and analyzes data to help businesses make informed decisions. A typical workflow involves understanding the business requirement, collecting relevant data, cleaning it, performing analysis, identifying trends or patterns, and presenting the findings through reports or dashboards."

3๏ธโƒฃ What is the difference between Data Analysis and Data Analytics?

Sample Answer:

"Data analysis generally focuses on examining data to understand what happened and why. Data analytics is a broader concept that includes data analysis along with processes such as data collection, preparation, visualization, statistical analysis, and sometimes predictive modeling. In practice, the terms are often used interchangeably depending on the organization."

4๏ธโƒฃ What is the difference between structured and unstructured data?

Sample Answer:

"Structured data has a predefined format or schema, such as rows and columns in a relational database. Examples include customer IDs, transaction amounts, and dates.

Unstructured data does not follow a predefined tabular structure. Examples include emails, images, videos, documents, and social media posts.

Semi-structured data sits between the two, such as JSON and XML, where the data has some organizational structure but doesn't necessarily follow a relational table format."

5๏ธโƒฃ What is data cleaning and why is it important?

Sample Answer:

"Data cleaning is the process of identifying and correcting problems in a dataset, such as missing values, duplicates, inconsistent formats, incorrect data types, and invalid values.

It is important because analysis performed on poor-quality data can produce misleading results. Before analyzing data, I would first understand the data quality issues and determine how each issue should be handled based on the business context."

6๏ธโƒฃ How do you handle missing values?

Sample Answer:

"I first investigate why the values are missing and how much data is affected. The appropriate treatment depends on the business context.

For example, I might remove records if only a very small number are affected and they aren't important to the analysis. For numerical fields, I might use an appropriate statistical value such as median or mean when justified. For categorical fields, I might use a meaningful category such as 'Unknown.'

I avoid blindly replacing missing values because missingness itself can sometimes contain useful information."

7๏ธโƒฃ How do you identify duplicate records?

Sample Answer:

"I first determine what defines a unique record. Then I compare the relevant columns or business key to identify duplicates.

For example, if Customer_ID and Transaction_ID together uniquely identify a transaction, I can use those fields to identify duplicate combinations.

In SQL, I could use GROUP BY with HAVING COUNT(**) > 1 to identify duplicated keys."

SELECT Customer_ID, Transaction_ID, COUNT(**) AS duplicate_count
FROM transactions
GROUP BY Customer_ID, Transaction_ID
HAVING COUNT(**) > 1;
โค8
"After identifying duplicates, I investigate whether they are genuine duplicate records or legitimate repeated transactions before removing anything."

8๏ธโƒฃ What is an outlier? How would you handle it?

Sample Answer:

"An outlier is a value that is significantly different from the typical observations in a dataset.

I wouldn't automatically remove an outlier. First, I would investigate whether it represents a data-quality issue or a genuine business event.

For example, a transaction worth โ‚น10 million might initially look like an outlier, but it could be a legitimate high-value transaction. If it is a data-entry error, I would correct or exclude it according to the business rules."

9๏ธโƒฃ What is the difference between a dimension and a measure?

Sample Answer:

"A dimension is generally used to categorize or describe data, while a measure is a numerical value that can usually be aggregated.

For example, in a sales dataset:

Dimensions: Customer, Product, Region, Date

Measures: Sales Amount, Quantity, Profit, Discount

In a dashboard, dimensions are commonly used to slice or group the data, while measures are used to calculate KPIs and metrics."

๐Ÿ”Ÿ What steps do you follow when solving a data analysis problem?

Sample Answer:

"I generally follow a structured approach:

1. Understand the business problem.

2. Define the required metrics and success criteria.

3. Identify the relevant data sources.

4. Extract and validate the data.

5. Clean and transform the data.

6. Perform exploratory analysis.

7. Identify trends, patterns, and anomalies.

8. Validate the results.

9. Communicate the insights using appropriate visualizations.

10. Recommend actions based on the findings.

The most important step is understanding the business question first, because technically correct analysis can still be useless if it doesn't answer the actual business problem."

๐Ÿ“Œ Double Tap โค๏ธ For Part-2
โค13
๐—™๐—ฅ๐—˜๐—˜ ๐—ฅ๐—ฒ๐˜€๐—ผ๐˜‚๐—ฟ๐—ฐ๐—ฒ๐˜€ ๐—ง๐—ผ ๐—Ÿ๐—ฒ๐—ฎ๐—ฟ๐—ป ๐—”๐—œ ๐—ถ๐—ป ๐Ÿฎ๐Ÿฌ๐Ÿฎ๐Ÿฒ๐Ÿš€
โ€‹
Explore 6 free resources covering AI fundamentals, tools, deep learning, research and real-world applications.

โœ… 100% Free Learning
โœ… Beginner-Friendly
โœ… AI โ€ข ML โ€ข Deep Learning
โœ… Real-World Applications

๐Ÿ”— ๐—˜๐˜…๐—ฝ๐—น๐—ผ๐—ฟ๐—ฒ ๐—™๐—ฅ๐—˜๐—˜ ๐—–๐—ผ๐˜‚๐—ฟ๐˜€๐—ฒ๐˜€ ๐Ÿ‘‡

https://pdlink.in/4AFHq5R

๐Ÿ“ข Share this valuable opportunity with your friends and classmates!
โค2
๐Ÿ“Š Data Analyst Interview Series โ€” Part 2

Guys, let's continue our Data Analyst Interview Series.

In Part 2, let's move into some important SQL and data-related interview questions that are frequently tested in Data Analyst interviews. ๐Ÿ‘‡

1๏ธโƒฃ What is SQL and why is it important for a Data Analyst?

Sample Answer:

"SQL stands for Structured Query Language. It is used to interact with relational databases. As a Data Analyst, I use SQL to retrieve, filter, join, aggregate, and analyze data. It is important because a large amount of business data is stored in databases, and SQL allows analysts to efficiently extract the data required for analysis."

2๏ธโƒฃ What is the difference between WHERE and HAVING?

Sample Answer:

"WHERE filters individual rows before aggregation, whereas HAVING filters groups after aggregation.

For example, if I want to find customers whose total sales exceed โ‚น1 lakh, I would use HAVING because the condition is applied to an aggregated result."

SELECT Customer_ID, SUM(Sales) AS Total_Sales
FROM Sales
GROUP BY Customer_ID
HAVING SUM(Sales) > 100000;


3๏ธโƒฃ What is the difference between INNER JOIN and LEFT JOIN?

Sample Answer:

"An INNER JOIN returns only the records that have matching values in both tables.

A LEFT JOIN returns all records from the left table and the matching records from the right table. If there is no match, the columns from the right table contain NULL."

For example, if I want all customers, including customers who haven't placed any orders, I would use a LEFT JOIN.

4๏ธโƒฃ What is a primary key?

Sample Answer:

"A primary key is a column or combination of columns that uniquely identifies each record in a table. It must contain unique values and cannot contain NULL values.

For example, Customer_ID can be a primary key in a Customer table if every customer has a unique ID."

5๏ธโƒฃ What is a foreign key?

Sample Answer:

"A foreign key is a column that references a primary key or another unique key in another table. It establishes a relationship between tables.

For example, Customer_ID in an Orders table can reference Customer_ID in the Customers table."

6๏ธโƒฃ What is the difference between UNION and UNION ALL?

Sample Answer:

"Both are used to combine the results of two or more SELECT statements.

UNION removes duplicate records from the combined result, while UNION ALL retains duplicates.

Because UNION performs duplicate elimination, UNION ALL can generally be faster when duplicate removal isn't required."

7๏ธโƒฃ What is a NULL value in SQL?

Sample Answer:

"NULL represents a missing, unknown, or unavailable value. It is different from zero, an empty string, or a blank value.

We should use IS NULL or IS NOT NULL to check for NULL values rather than using an equals operator."

SELECT *
FROM Customers
WHERE Email IS NULL;


8๏ธโƒฃ What is GROUP BY used for?

Sample Answer:

"GROUP BY is used to group rows that have the same values in one or more columns so that aggregate functions can be applied to each group.

For example, to calculate total sales by region:"

SELECT Region, SUM(Sales) AS Total_Sales
FROM Sales
GROUP BY Region;


9๏ธโƒฃ What are aggregate functions in SQL?

Sample Answer:

"Aggregate functions perform calculations on multiple rows and return a single result for each group.

Common aggregate functions include:"

โ€ข COUNT() โ€” counts records

โ€ข SUM() โ€” calculates the total

โ€ข AVG() โ€” calculates the average

โ€ข MIN() โ€” finds the minimum value

โ€ข MAX() โ€” finds the maximum value

For example:

SELECT
COUNT(*) AS Total_Orders,
SUM(Sales) AS Total_Sales,
AVG(Sales) AS Average_Sales
FROM Sales;
โค6
๐Ÿ”Ÿ How would you find duplicate records in SQL?

Sample Answer:

"I would first identify the column or combination of columns that should uniquely identify a record. Then I would use GROUP BY and HAVING COUNT(*) > 1."

SELECT Customer_ID, COUNT(*) AS Count_Records
FROM Customers
GROUP BY Customer_ID
HAVING COUNT(*) > 1;


"This identifies Customer_ID values that appear more than once. I would then investigate whether those records are genuine duplicates before taking any corrective action."

๐Ÿ“Œ Double Tap โค๏ธ For Part-3
โค16
๐Ÿ“Š Data Analyst Interview Series โ€” Part 3

Guys, let's continue our Data Analyst Interview Series.

Today, let's cover 10 important SQL interview questions that test your practical SQL knowledge. ๐Ÿ‘‡

1๏ธโƒฃ What is a subquery in SQL?

Sample Answer:

โ€œA subquery is a query written inside another SQL query. It can be used to retrieve intermediate results that are then used by the outer query.

For example, to find employees whose salary is greater than the average salary:โ€

SELECT Employee_ID, Salary
FROM Employees
WHERE Salary > (
SELECT AVG(Salary)
FROM Employees
);


2๏ธโƒฃ What is a CTE?

Sample Answer:

โ€œCTE stands for Common Table Expression. It allows us to define a temporary named result set using the WITH clause, which can then be referenced within the main query.

CTEs make complex queries easier to read, maintain, and debug.โ€

WITH CustomerSales AS (
SELECT Customer_ID,
SUM(Sales) AS Total_Sales
FROM Sales
GROUP BY Customer_ID
)
SELECT *
FROM CustomerSales
WHERE Total_Sales > 100000;


3๏ธโƒฃ What is a window function?

Sample Answer:

โ€œA window function performs a calculation across a set of related rows while still retaining the individual rows in the result.

Unlike GROUP BY, it does not collapse multiple rows into a single row.

Common window functions include ROW_NUMBER(), RANK(), DENSE_RANK(), LAG(), and LEAD().โ€

4๏ธโƒฃ What is the difference between RANK(), DENSE_RANK(), and ROW_NUMBER()?

Sample Answer:

โ€œROW_NUMBER() assigns a unique sequential number to every row.

RANK() assigns the same rank to tied values but leaves gaps after a tie.

DENSE_RANK() also assigns the same rank to tied values but does not leave gaps.โ€

Example:

Values: 100, 100, 90

ROW_NUMBER: 1, 2, 3

RANK: 1, 1, 3

DENSE_RANK: 1, 1, 2

5๏ธโƒฃ How would you find the second-highest salary?

Sample Answer:

โ€œOne approach is to use DENSE_RANK(). This also handles duplicate salaries correctly.โ€

WITH RankedEmployees AS (
SELECT Employee_ID,
Salary,
DENSE_RANK() OVER (ORDER BY Salary DESC) AS Salary_Rank
FROM Employees
)
SELECT Employee_ID, Salary
FROM RankedEmployees
WHERE Salary_Rank = 2;


6๏ธโƒฃ How would you find the top 3 salaries in each department?

Sample Answer:

โ€œI would use a window function to rank employees within each department.โ€

WITH RankedEmployees AS (
SELECT Employee_ID,
Department,
Salary,
DENSE_RANK() OVER (
PARTITION BY Department
ORDER BY Salary DESC
) AS Salary_Rank
FROM Employees
)
SELECT *
FROM RankedEmployees
WHERE Salary_Rank <= 3;


โ€œThe PARTITION BY ensures that ranking starts separately for each department.โ€

7๏ธโƒฃ What is PARTITION BY in SQL?

Sample Answer:

โ€œPARTITION BY divides the result set into groups for a window function without collapsing the rows.

For example, if I want to rank employees separately within each department, I can use PARTITION BY Department.โ€

SELECT Employee_ID,
Department,
Salary,
RANK() OVER (
PARTITION BY Department
ORDER BY Salary DESC
) AS Salary_Rank
FROM Employees;


8๏ธโƒฃ What are LAG() and LEAD() functions?

Sample Answer:

โ€œLAG() allows me to access a value from a previous row, while LEAD() allows me to access a value from a following row.

They are particularly useful for comparing current values with previous or future values, such as month-over-month sales.โ€

SELECT Month,
Sales,
LAG(Sales) OVER (ORDER BY Month) AS Previous_Month_Sales
FROM Monthly_Sales;
โค4
9๏ธโƒฃ How would you calculate month-over-month growth?

Sample Answer:

โ€œI would first retrieve the previous month's sales using LAG(), then calculate the percentage change between the current month and previous month.โ€

SELECT Month,
Sales,
LAG(Sales) OVER (ORDER BY Month) AS Previous_Sales,
(Sales - LAG(Sales) OVER (ORDER BY Month))
* 100.0 /
LAG(Sales) OVER (ORDER BY Month) AS MoM_Growth
FROM Monthly_Sales;


โ€œI would also handle cases where the previous month's value is zero or NULL to avoid incorrect calculations.โ€

๐Ÿ”Ÿ What is the difference between DELETE, TRUNCATE, and DROP?

Sample Answer:

โ€œDELETE removes selected rows from a table and can be used with a WHERE condition.

TRUNCATE removes all rows from a table while keeping the table structure.

DROP removes the entire table, including its structure and data.

So, the key difference is whether I'm removing specific records, all records, or the entire table itself.โ€

๐Ÿ“Œ Double Tap โค๏ธ For Part-4
โค19
๐— ๐—ฎ๐˜€๐˜๐—ฒ๐—ฟ ๐—ฃ๐—ผ๐˜„๐—ฒ๐—ฟ ๐—•๐—œ ๐—ณ๐—ผ๐—ฟ ๐—™๐—ฅ๐—˜๐—˜! ๐Ÿ”ฅ

Learn Power BI through these FREE learning resources
โ€‹
โœจ What You'll Learn:
๐Ÿ“Š Interactive Dashboards
๐Ÿ“ˆ Data Visualization
๐Ÿงน Data Transformation
๐Ÿ’ผ Real-World Reporting Skills
๐ŸŽฏ Beginner-Friendly โ€” No Coding Required

๐—ฆ๐˜๐—ฎ๐—ฟ๐˜ ๐—Ÿ๐—ฒ๐—ฎ๐—ฟ๐—ป๐—ถ๐—ป๐—ด ๐—ณ๐—ผ๐—ฟ ๐—™๐—ฅ๐—˜๐—˜
โ€‹
โ€‹https://pdlink.in/4hznwlu

๐Ÿ’ซPerfect for Students โ€ข Freshers โ€ข Data Analyst Aspirants โ€ข Working Professionals
๐Ÿ“Š Data Analyst Interview Series โ€” Part 4

Guys, let's continue our Data Analyst Interview Series.

Today, let's cover 10 practical SQL questions that are commonly asked in Data Analyst interviews. ๐Ÿ‘‡

1๏ธโƒฃ How do you find the highest salary in each department?

Sample Answer:

"I would use a window function such as DENSE_RANK() and partition the data by department."

WITH RankedEmployees AS (
SELECT Employee_ID,
Department,
Salary,
DENSE_RANK() OVER (
PARTITION BY Department
ORDER BY Salary DESC
) AS Salary_Rank
FROM Employees
)
SELECT Employee_ID, Department, Salary
FROM RankedEmployees
WHERE Salary_Rank = 1;


2๏ธโƒฃ How do you find customers who have never placed an order?

Sample Answer:

"I would use a LEFT JOIN between the Customers and Orders tables and then filter for customers where no matching order exists."

SELECT c.Customer_ID,
c.Customer_Name
FROM Customers c
LEFT JOIN Orders o
ON c.Customer_ID = o.Customer_ID
WHERE o.Customer_ID IS NULL;


3๏ธโƒฃ How do you find the total sales for each customer?

Sample Answer:

"I would group the sales data by Customer_ID and use SUM() to calculate the total sales."

SELECT Customer_ID,
SUM(Sales) AS Total_Sales
FROM Orders
GROUP BY Customer_ID;


4๏ธโƒฃ How do you find the top 5 customers by sales?

Sample Answer:

"I would aggregate sales by customer, sort the result in descending order, and then return the top five customers."

SELECT Customer_ID,
SUM(Sales) AS Total_Sales
FROM Orders
GROUP BY Customer_ID
ORDER BY Total_Sales DESC
LIMIT 5;


"The exact syntax for limiting rows can vary depending on the database, such as TOP in SQL Server."

5๏ธโƒฃ How do you calculate the average order value?

Sample Answer:

"Average Order Value can be calculated by dividing total sales by the number of orders. If each row represents one order, AVG() can also be used directly on the order amount."

SELECT AVG(Order_Amount) AS Average_Order_Value
FROM Orders;


6๏ธโƒฃ How would you identify customers who placed more than 5 orders?

Sample Answer:

"I would group the orders by Customer_ID and use HAVING to filter customers whose order count is greater than five."

SELECT Customer_ID,
COUNT(**) AS Order_Count
FROM Orders
GROUP BY Customer_ID
HAVING COUNT(**) > 5;


7๏ธโƒฃ How do you find records from the last 30 days?

Sample Answer:

"I would compare the date column with the current date and subtract 30 days. The exact syntax depends on the database."

For example:

SELECT **
FROM Orders
WHERE Order_Date >= CURRENT_DATE - INTERVAL '30' DAY;


8๏ธโƒฃ How do you find the total sales by month?

Sample Answer:

"I would extract the month from the order date, group the data by month, and calculate the total sales."

SELECT
DATE_TRUNC('month', Order_Date) AS Month,
SUM(Sales) AS Total_Sales
FROM Orders
GROUP BY DATE_TRUNC('month', Order_Date)
ORDER BY Month;


9๏ธโƒฃ How do you find employees whose salary is above their department's average salary?

Sample Answer:

"I would calculate the average salary for each department and compare each employee's salary with that department-level average. A CTE makes this easier to read."

WITH DepartmentAverage AS (
SELECT Department,
AVG(Salary) AS Avg_Salary
FROM Employees
GROUP BY Department
)
SELECT e.Employee_ID,
e.Department,
e.Salary
FROM Employees e
JOIN DepartmentAverage d
ON e.Department = d.Department
WHERE e.Salary > d.Avg_Salary;
๐Ÿ‘2โค1
๐Ÿ”Ÿ What is the difference between UNION and JOIN?

Sample Answer:

"JOIN combines columns from different tables based on a related key.

UNION combines rows from the results of two SELECT statements with compatible column structures.

For example, if I want to combine customer information with order information, I would typically use a JOIN. If I want to append two similar datasets containing the same type of records, I might use UNION."

๐Ÿ“Œ Double Tap โค๏ธ For Part 5
โค7
๐Ÿš€๐—ฃ๐—ฎ๐˜† ๐—”๐—ณ๐˜๐—ฒ๐—ฟ ๐—ฃ๐—น๐—ฎ๐—ฐ๐—ฒ๐—บ๐—ฒ๐—ป๐˜ ๐—ง๐—ฟ๐—ฎ๐—ถ๐—ป๐—ถ๐—ป๐—ด | ๐—•๐—ฒ๐—ฐ๐—ผ๐—บ๐—ฒ ๐—ฎ ๐—™๐˜‚๐—น๐—น๐˜€๐˜๐—ฎ๐—ฐ๐—ธ ๐——๐—ฒ๐˜ƒ๐—ฒ๐—น๐—ผ๐—ฝ๐—ฒ๐—ฟ ๐—ช๐—œ๐˜๐—ต ๐—š๐—ฒ๐—ป๐—”๐—œ

Start a high-paying tech careerโ€”even without prior coding experience

๐Ÿ† ๐—ฃ๐—น๐—ฎ๐—ฐ๐—ฒ๐—บ๐—ฒ๐—ป๐˜ ๐—›๐—ถ๐—ด๐—ต๐—น๐—ถ๐—ด๐—ต๐˜๐˜€:
๐Ÿ’ฐ โ‚น41 LPA highest salary
๐Ÿ“ˆ โ‚น7.4 LPA average salary
๐ŸŽ“ 2,000+ students placed
๐Ÿข 500+ hiring partners
โœ… 100% job assistance
๐Ÿ“œ Skill Indiaโ€“authenticated certificate

๐Ÿ”— ๐—”๐—ฝ๐—ฝ๐—น๐˜† ๐—ก๐—ผ๐˜„๐Ÿ‘‡:-

https://pdlink.in/3SuUeuD

๐ŸŽฏ HurryUp.....Limited Seats Available
โค2