Data Analytics
Perfect channel to learn Data Analytics Learn SQL, Python, Alteryx, Tableau, Power BI and many more For Promotions: @coderfun @love_data
Больше📈 Аналитический обзор Telegram-канала Data Analytics
Канал Data Analytics (@sqlspecialist) языкового сегмента Английский является активным участником. Сейчас сообщество объединяет 110 984 подписчиков, занимая 1 062 место в категории Технологии и приложения и 2 215 место в регионе Индия.
📊 Показатели аудитории и динамика
С момента создания невідомо проект демонстрирует стремительный рост, собрав аудиторию из 110 984 подписчиков.
Согласно последним данным от 05 октября, 2026, канал показывает стабильную активность. За последние 30 дней изменение числа участников составило 149, а за последние 24 часа — 26, при этом общий охват остаётся высоким.
- Статус верификации: Не верифицирован
- Уровень вовлечённости (ER): Средний показатель вовлечённости аудитории составляет 2.67%. В первые 24 часа после публикации контент обычно набирает 1.34% реакций от общего числа подписчиков.
- Охват публикаций: В среднем каждый пост получает 2 960 просмотров. В течение первых суток публикация набирает 1 483 просмотров.
- Реакции и взаимодействия: Аудитория активно поддерживает контент: среднее количество реакций на один пост — 5.
- Тематические интересы: Контент сосредоточен на ключевых темах, таких как row, sql, analytic, analyst, visualization.
📝 Описание и контентная политика
Автор описывает ресурс как площадку для выражения субъективного мнения:
“Perfect channel to learn Data Analytics
Learn SQL, Python, Alteryx, Tableau, Power BI and many more
For Promotions: @coderfun @love_data”
Благодаря высокой частоте обновлений (последние данные получены 06 октября, 2026) канал поддерживает актуальность и высокий уровень охвата публикаций. Аналитика показывает, что аудитория активно взаимодействует с контентом, что делает его важной точкой влияния в категории Технологии и приложения.
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
-----
1.28 ₽ · /balance_helpSELECT 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;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
-----
1.38 ₽ · /balance_helpSELECT 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;SELECT Customer_ID, Transaction_ID, COUNT(**) AS duplicate_count
FROM transactions
GROUP BY Customer_ID, Transaction_ID
HAVING COUNT(**) > 1;SELECT Customer_ID, Transaction_ID, COUNT(**) AS duplicate_count
FROM transactions
GROUP BY Customer_ID, Transaction_ID
HAVING COUNT(**) > 1;Performance =
SWITCH(
TRUE(),
[Profit Margin] >= 0.30, "Excellent",
[Profit Margin] >= 0.15, "Good",
[Profit Margin] >= 0, "Needs Improvement",
"Loss"
)
It evaluates conditions and returns the corresponding result.
This is useful for:
✔ KPI categories
✔ Business rules
✔ Dynamic labels
✔ Conditional calculations
✔ Performance classification
🔹 10. Building a Dynamic Customer Message
You can combine these functions to create business-friendly messages.
Example:
Customer Message =
"Selected Customers: "
&
COUNTROWS(VALUES(Sales[CustomerID]))
If the current filter context contains 125 unique customers:
• Selected Customers: 125
This can be displayed inside a Card or used in a report title.
🔹 11. Why These Functions Matter
Real dashboards rarely show the same calculation under every situation.
Users interact with:
• Slicers
• Filters
• Drill-downs
• Cross-highlighting
• Page filters
Your DAX measures should respond appropriately.
Functions such as:
• "FILTER()"
• "VALUES()"
• "SELECTEDVALUE()"
• "HASONEVALUE()"
• "SWITCH()"
help you build that dynamic behavior.
🎯 Interview Questions
1️⃣ What does FILTER() do?
• It returns a filtered table based on a specified condition.
2️⃣ What does SELECTEDVALUE() return?
• The single value in the current context, or an alternate result when there isn't exactly one value.
3️⃣ What is HASONEVALUE() used for?
• To check whether exactly one unique value exists in the current filter context.
4️⃣ How can SELECTEDVALUE() be used in a dashboard?
• It can create dynamic titles, labels, messages, and calculations based on slicer selections.
5️⃣ Why is SWITCH() useful in DAX?
• It allows multiple conditions or selections to determine which result should be returned.
🧪 PRACTICE
Create a Region slicer.
Then create:
✔ Selected Region
✔ Customer Count
✔ Dynamic Sales Title
✔ Dynamic KPI using SWITCH()
✔ One Region / Multiple Regions indicator
Select different regions and observe how every measure responds.
💡 Key lesson:
Advanced DAX is largely about making calculations respond intelligently to the user's current context.
Once you understand:
• FILTER()
• VALUES()
• SELECTEDVALUE()
• HASONEVALUE()
• SWITCH()
you can start building genuinely interactive Power BI reports.
Double Tap ❤️ For More
-----
1.37 ₽ · /balance_helpHigh Value Sales =
CALCULATE(
[Total Sales],
FILTER(
Sales,
Sales[SalesAmount] > 10000
)
)
This keeps only transactions where SalesAmount is greater than 10,000.
The important thing to understand:
• "FILTER()" works with a table and evaluates a condition for each row.
• Use it when your filtering requirement is more complex than a simple condition.
🔹 2. VALUES()
"VALUES()" returns the unique values from a column based on the current filter context.
Example:
Customer Count =
COUNTROWS(
VALUES(Sales[CustomerID])
)
This counts the unique customers visible in the current context.
For example:
• Without filters → 1,000 customers
• Region = West → 250 customers
• Region = South → 300 customers
The result changes according to the report filters.
🔹 3. VALUES() vs DISTINCT()
Both can return unique values, but they aren't identical in every situation.
A useful beginner-level rule:
• "DISTINCT()" → returns unique values from a column.
• "VALUES()" → returns unique values while also being sensitive to the current DAX context and can include a blank value when appropriate.
In advanced DAX, "VALUES()" is extremely useful for understanding what values are currently available in the filter context.
🔹 4. SELECTEDVALUE()
This is one of the most useful functions for interactive reports.
Suppose you have a Region slicer.
You can write:
Selected Region =
SELECTEDVALUE(
Sales[Region],
"Multiple Regions"
)
If the user selects:
• West → Result: West
• West + South → Result: Multiple Regions
If nothing is selected, the result can also return the alternate value depending on the filter context.
🔹 5. SELECTEDVALUE() with Dynamic Titles
You can use SELECTEDVALUE() to make report titles dynamic.
Example:
Sales Title =
"Sales Performance - "
&
SELECTEDVALUE(
Sales[Region],
"All Regions"
)
If the user selects West:
• Sales Performance - West
If multiple regions are selected:
• Sales Performance - All Regions
This makes dashboards much more interactive.
🔹 6. HASONEVALUE()
"HASONEVALUE()" checks whether exactly one unique value exists in the current filter context.
Example:
Single Region Selected =
IF(
HASONEVALUE(Sales[Region]),
"One Region",
"Multiple Regions"
)
If exactly one region is selected:
• One Region
Otherwise:
• Multiple Regions
🔹 7. SELECTEDVALUE() vs HASONEVALUE()
They are related but serve different purposes.
"HASONEVALUE()" asks:
• "Is exactly one value selected?"
"SELECTEDVALUE()" asks:
• "What is that selected value?"
For example:
SELECTEDVALUE(Sales[Region]) returns the actual region.
HASONEVALUE(Sales[Region]) returns TRUE or FALSE.
🔹 8. Dynamic KPI Calculation
Suppose you want a KPI to change based on a slicer containing:
• Sales
• Profit
• Orders
A measure can use the selected value to determine what should be displayed.
Conceptually:
Selected KPI =
SWITCH(
SELECTEDVALUE(KPI[KPI Name]),
"Sales", [Total Sales],
"Profit", [Total Profit],
"Orders", [Total Orders]
)
Now one visual can display different KPIs based on the user's selection.
This is called a:
• 👉 Dynamic Measure
🔹 9. SWITCH()
"SWITCH()" is extremely useful for dynamic DAX.
Instead of writing many nested IF statements: