If you understand filter context, you'll understand much more advanced DAX later.
๐น 10. CALCULATE()
One of the most important DAX functions is CALCULATE(). It evaluates an expression after modifying the filter context.
For example:
West Sales = CALCULATE([Total Sales], Customers[Region] = "West")
This calculates sales specifically for the West region.
๐น 11. Why CALCULATE() Is So Important
Many advanced DAX calculations are built around CALCULATE().
It is commonly used for:
โข Conditional calculations, Time intelligence, Comparisons, Removing filters, Adding filters, Changing filter context
Learning CALCULATE() properly is one of the biggest milestones in Power BI.
๐น 12. Measures Can Use Other Measures
You don't need to repeat the same logic everywhere.
โข Total Sales = SUM(Sales[Sales_Amount])
โข Total Cost = SUM(Sales[Cost])
โข Total Profit = [Total Sales] - [Total Cost]
This makes your model easier to maintain.
๐น 13. Profit Margin
You can create:
Profit Margin = DIVIDE([Total Profit], [Total Sales])
DIVIDE() is generally safer than manually using "/" because it handles division-by-zero cases more gracefully.
๐น 14. DIVIDE() vs "/"
Instead of [Total Profit] / [Total Sales] prefer:
Profit Margin = DIVIDE([Total Profit], [Total Sales], 0)
You can also specify an alternate result (0) when denominator is zero.
๐น 15. Calculated Column vs Measure โ When to Use Which?
Simple rule:
โข Use a calculated column when you need a value stored for each row. Examples: Profit per transaction, Customer category, Product classification
โข Use a measure when you need an aggregated or dynamically calculated result. Examples: Total Sales, Total Profit, Profit Margin, Average Order Value, Sales Growth %
For most report-level KPIs, measures are usually preferred.
๐น 16. Row Context
Calculated columns work with row context.
For example: Profit = Sales[Sales_Amount] - Sales[Cost]
Power BI evaluates this expression for each row. Think: Row Context = "Which row am I currently calculating?"
๐น 17. Filter Context vs Row Context
โข Row Context โ Focuses on the current row
โข Filter Context โ Defines which data is included in a calculation
Simple example: Calculated Column โ Row by row. Measure โ Based on current filter context.
Understanding this distinction is essential before moving into advanced DAX.
๐น 18. COUNTROWS()
COUNTROWS() counts rows in a table.
Example: Total Orders = COUNTROWS(Sales)
If one row represents one order, this can represent order count. But if your table contains multiple rows per order, it may not. In that situation: Total Orders = DISTINCTCOUNT(Sales[Order_ID]) may be more appropriate.
Always understand the grain of your table.
๐น 19. RELATED()
RELATED() can retrieve a value from a related table when working in row context.
For example: Region = RELATED(Customers[Region])
This can bring the customer's region into a row-level calculation when the relationship and model support it.
๐น 20. Don't Create Everything as a Calculated Column
A common beginner mistake is creating columns for every calculation.
For example: Total Sales, Total Profit, Average Sales, Profit Margin, Sales Growth
๐น 10. CALCULATE()
One of the most important DAX functions is CALCULATE(). It evaluates an expression after modifying the filter context.
For example:
West Sales = CALCULATE([Total Sales], Customers[Region] = "West")
This calculates sales specifically for the West region.
๐น 11. Why CALCULATE() Is So Important
Many advanced DAX calculations are built around CALCULATE().
It is commonly used for:
โข Conditional calculations, Time intelligence, Comparisons, Removing filters, Adding filters, Changing filter context
Learning CALCULATE() properly is one of the biggest milestones in Power BI.
๐น 12. Measures Can Use Other Measures
You don't need to repeat the same logic everywhere.
โข Total Sales = SUM(Sales[Sales_Amount])
โข Total Cost = SUM(Sales[Cost])
โข Total Profit = [Total Sales] - [Total Cost]
This makes your model easier to maintain.
๐น 13. Profit Margin
You can create:
Profit Margin = DIVIDE([Total Profit], [Total Sales])
DIVIDE() is generally safer than manually using "/" because it handles division-by-zero cases more gracefully.
๐น 14. DIVIDE() vs "/"
Instead of [Total Profit] / [Total Sales] prefer:
Profit Margin = DIVIDE([Total Profit], [Total Sales], 0)
You can also specify an alternate result (0) when denominator is zero.
๐น 15. Calculated Column vs Measure โ When to Use Which?
Simple rule:
โข Use a calculated column when you need a value stored for each row. Examples: Profit per transaction, Customer category, Product classification
โข Use a measure when you need an aggregated or dynamically calculated result. Examples: Total Sales, Total Profit, Profit Margin, Average Order Value, Sales Growth %
For most report-level KPIs, measures are usually preferred.
๐น 16. Row Context
Calculated columns work with row context.
For example: Profit = Sales[Sales_Amount] - Sales[Cost]
Power BI evaluates this expression for each row. Think: Row Context = "Which row am I currently calculating?"
๐น 17. Filter Context vs Row Context
โข Row Context โ Focuses on the current row
โข Filter Context โ Defines which data is included in a calculation
Simple example: Calculated Column โ Row by row. Measure โ Based on current filter context.
Understanding this distinction is essential before moving into advanced DAX.
๐น 18. COUNTROWS()
COUNTROWS() counts rows in a table.
Example: Total Orders = COUNTROWS(Sales)
If one row represents one order, this can represent order count. But if your table contains multiple rows per order, it may not. In that situation: Total Orders = DISTINCTCOUNT(Sales[Order_ID]) may be more appropriate.
Always understand the grain of your table.
๐น 19. RELATED()
RELATED() can retrieve a value from a related table when working in row context.
For example: Region = RELATED(Customers[Region])
This can bring the customer's region into a row-level calculation when the relationship and model support it.
๐น 20. Don't Create Everything as a Calculated Column
A common beginner mistake is creating columns for every calculation.
For example: Total Sales, Total Profit, Average Sales, Profit Margin, Sales Growth
โค3
These are generally better candidates for measures, because they need to respond dynamically to report filters.
๐ฏ Power BI Interview Questions
โข
What is DAX? DAX is the formula language used in Power BI for analytical calculations.
โข
What is the difference between a calculated column and a measure? A calculated column calculates values row by row and stores them in the model. A measure calculates dynamically based on the current filter context.
โข
What is filter context? The set of filters affecting a DAX calculation.
โข
What is row context? The current row being evaluated, particularly relevant to calculated columns and certain DAX iterators.
โข
What does CALCULATE() do? It evaluates an expression after modifying the filter context.
โข
Why use DIVIDE()? It provides safer division handling, especially when the denominator can be zero or blank.
๐ฏ Practice Task
Create these measures in a sample Sales model:
โข Total Sales = SUM(Sales[Sales_Amount])
โข Total Cost = SUM(Sales[Cost])
โข Total Profit = [Total Sales] - [Total Cost]
โข Profit Margin = DIVIDE([Total Profit], [Total Sales])
Then create Cards for each measure. Add a Region slicer. Change the region and observe what happens. This is one of the easiest ways to understand filter context practically.
๐ก The biggest DAX concept to understand at this stage is: A measure doesn't simply calculate a number. It calculates a number based on the current context of your report.
Power BI Resources: https://whatsapp.com/channel/0029Vai1xKf1dAvuk6s1v22c
Double Tap โค๏ธ For Part-5
๐ฏ Power BI Interview Questions
โข
What is DAX? DAX is the formula language used in Power BI for analytical calculations.
โข
What is the difference between a calculated column and a measure? A calculated column calculates values row by row and stores them in the model. A measure calculates dynamically based on the current filter context.
โข
What is filter context? The set of filters affecting a DAX calculation.
โข
What is row context? The current row being evaluated, particularly relevant to calculated columns and certain DAX iterators.
โข
What does CALCULATE() do? It evaluates an expression after modifying the filter context.
โข
Why use DIVIDE()? It provides safer division handling, especially when the denominator can be zero or blank.
๐ฏ Practice Task
Create these measures in a sample Sales model:
โข Total Sales = SUM(Sales[Sales_Amount])
โข Total Cost = SUM(Sales[Cost])
โข Total Profit = [Total Sales] - [Total Cost]
โข Profit Margin = DIVIDE([Total Profit], [Total Sales])
Then create Cards for each measure. Add a Region slicer. Change the region and observe what happens. This is one of the easiest ways to understand filter context practically.
๐ก The biggest DAX concept to understand at this stage is: A measure doesn't simply calculate a number. It calculates a number based on the current context of your report.
Power BI Resources: https://whatsapp.com/channel/0029Vai1xKf1dAvuk6s1v22c
Double Tap โค๏ธ For Part-5
โค5
๐ง๐ผ๐ฝ ๐ญ๐ฑ ๐ฃ๐๐๐ต๐ผ๐ป ๐๐ป๐๐ฒ๐ฟ๐๐ถ๐ฒ๐ ๐ค๐๐ฒ๐๐๐ถ๐ผ๐ป๐ ๐ฌ๐ผ๐ ๐ ๐จ๐ฆ๐ง ๐๐ป๐ผ๐! ๐ฅ
Preparing for a Python Developer or Data Analyst interview?
Strengthen your fundamentals with these essential interview topics.
๐ฏ Perfect for Students โข Freshers โข Python Learners โข Data Analyst Aspirants
๐ ๐๐ฒ๐ ๐๐ต๐ฒ ๐๐ป๐๐ฒ๐ฟ๐๐ถ๐ฒ๐ ๐ค๐๐ฒ๐๐๐ถ๐ผ๐ป๐ ๐
https://pdlink.in/3TAUwk7
๐Save this for your next interview and share it with a friend!
Preparing for a Python Developer or Data Analyst interview?
Strengthen your fundamentals with these essential interview topics.
๐ฏ Perfect for Students โข Freshers โข Python Learners โข Data Analyst Aspirants
๐ ๐๐ฒ๐ ๐๐ต๐ฒ ๐๐ป๐๐ฒ๐ฟ๐๐ถ๐ฒ๐ ๐ค๐๐ฒ๐๐๐ถ๐ผ๐ป๐ ๐
https://pdlink.in/3TAUwk7
๐Save this for your next interview and share it with a friend!
๐ Data Analyst Roadmap โ Part 26
POWER BI LEVEL 5 โ DAX: CALCULATE(), FILTERS & CONTEXT
If you understand CALCULATE(), DAX becomes much easier.
The most important idea:
๐ CALCULATE() changes the filter context in which a measure is evaluated.
Example:
Total Sales =
SUM(Sales)[SalesAmount]
Now suppose you want sales only for the West region:
West Sales = CALCULATE( [Total Sales], Sales[Region] = "West" )
CALCULATE() takes the existing calculation and applies an additional filter.
๐น 1. CALCULATE() with multiple filters
You can apply multiple conditions:
West Electronics Sales = CALCULATE( [Total Sales], Sales[Region] = "West", Sales[Category] = "Electronics" )
This calculates sales where:
Region = West
AND
Category = Electronics
๐น 2. REMOVEFILTERS()
Sometimes you don't want a slicer or visual filter to affect your calculation.
Example:
Total Sales All Regions = CALCULATE( [Total Sales], REMOVEFILTERS(Sales[Region]) )
If a report is filtered to:
Region โ West
this measure still shows sales across all regions.
๐น 3. ALL()
ALL() can also remove filters.
Example:
Total Sales All Regions = CALCULATE( [Total Sales], ALL(Sales[Region]) )
A common use is calculating percentage of total.
Sales % of Total = DIVIDE( [Total Sales], CALCULATE( [Total Sales], ALL(Sales[Region]) ) )
If West has โน20 lakh sales and all regions have โน100 lakh:
Sales % of Total = 20%
๐น 4. ALLSELECTED()
ALLSELECTED() is useful when you want to respect the user's overall selections but ignore a visual-level grouping.
Example:
Sales % of Selected Regions = DIVIDE( [Total Sales], CALCULATE( [Total Sales], ALLSELECTED(Sales[Region]) ) )
If the user selects:
West + South
the calculation can compare each region against the total of the selected regions rather than the entire dataset.
๐น 5. KEEPFILTERS()
By default, CALCULATE() can replace an existing filter on the same column.
KEEPFILTERS() tells DAX to preserve the existing filter and apply the new condition on top of it.
Example:
CALCULATE( [Total Sales], KEEPFILTERS(Sales[Category] = "Electronics") )
Think of it as:
Existing filters
+
New filter
instead of replacing the existing filter.
๐น 6. FILTER()
FILTER() creates a filtered table based on a condition.
Example:
High Value Sales = CALCULATE( [Total Sales], FILTER( Sales, Sales[SalesAmount] > 10000))
This calculates sales from transactions greater than โน10,000.
Use FILTER() when the filtering logic is more complex than a simple column = value condition.
๐น 7. Context Transition
This sounds complicated, but the basic idea is simple.
DAX has two important contexts:
๐ Row Context
Works with the current row.
๐ Filter Context
Determines which data is included in a calculation.
CALCULATE() has a special behavior:
It can convert row context into filter context.
This is called:
Context Transition
You will encounter this especially when using CALCULATE() inside calculated columns or iterator functions such as SUMX(), FILTER(), etc.
๐ก A simple way to remember CALCULATE():
CALCULATE() = "Calculate this measure, but under these filter conditions."
For example:
[Total Sales]
โ
CALCULATE(
[Total Sales],
Region = "West"
)
โ
"Calculate Total Sales, but only for West."
POWER BI LEVEL 5 โ DAX: CALCULATE(), FILTERS & CONTEXT
If you understand CALCULATE(), DAX becomes much easier.
The most important idea:
๐ CALCULATE() changes the filter context in which a measure is evaluated.
Example:
Total Sales =
SUM(Sales)[SalesAmount]
Now suppose you want sales only for the West region:
West Sales = CALCULATE( [Total Sales], Sales[Region] = "West" )
CALCULATE() takes the existing calculation and applies an additional filter.
๐น 1. CALCULATE() with multiple filters
You can apply multiple conditions:
West Electronics Sales = CALCULATE( [Total Sales], Sales[Region] = "West", Sales[Category] = "Electronics" )
This calculates sales where:
Region = West
AND
Category = Electronics
๐น 2. REMOVEFILTERS()
Sometimes you don't want a slicer or visual filter to affect your calculation.
Example:
Total Sales All Regions = CALCULATE( [Total Sales], REMOVEFILTERS(Sales[Region]) )
If a report is filtered to:
Region โ West
this measure still shows sales across all regions.
๐น 3. ALL()
ALL() can also remove filters.
Example:
Total Sales All Regions = CALCULATE( [Total Sales], ALL(Sales[Region]) )
A common use is calculating percentage of total.
Sales % of Total = DIVIDE( [Total Sales], CALCULATE( [Total Sales], ALL(Sales[Region]) ) )
If West has โน20 lakh sales and all regions have โน100 lakh:
Sales % of Total = 20%
๐น 4. ALLSELECTED()
ALLSELECTED() is useful when you want to respect the user's overall selections but ignore a visual-level grouping.
Example:
Sales % of Selected Regions = DIVIDE( [Total Sales], CALCULATE( [Total Sales], ALLSELECTED(Sales[Region]) ) )
If the user selects:
West + South
the calculation can compare each region against the total of the selected regions rather than the entire dataset.
๐น 5. KEEPFILTERS()
By default, CALCULATE() can replace an existing filter on the same column.
KEEPFILTERS() tells DAX to preserve the existing filter and apply the new condition on top of it.
Example:
CALCULATE( [Total Sales], KEEPFILTERS(Sales[Category] = "Electronics") )
Think of it as:
Existing filters
+
New filter
instead of replacing the existing filter.
๐น 6. FILTER()
FILTER() creates a filtered table based on a condition.
Example:
High Value Sales = CALCULATE( [Total Sales], FILTER( Sales, Sales[SalesAmount] > 10000))
This calculates sales from transactions greater than โน10,000.
Use FILTER() when the filtering logic is more complex than a simple column = value condition.
๐น 7. Context Transition
This sounds complicated, but the basic idea is simple.
DAX has two important contexts:
๐ Row Context
Works with the current row.
๐ Filter Context
Determines which data is included in a calculation.
CALCULATE() has a special behavior:
It can convert row context into filter context.
This is called:
Context Transition
You will encounter this especially when using CALCULATE() inside calculated columns or iterator functions such as SUMX(), FILTER(), etc.
๐ก A simple way to remember CALCULATE():
CALCULATE() = "Calculate this measure, but under these filter conditions."
For example:
[Total Sales]
โ
CALCULATE(
[Total Sales],
Region = "West"
)
โ
"Calculate Total Sales, but only for West."
โค2
๐ฏ Interview Questions
1๏ธโฃ What does CALCULATE() do?
It evaluates an expression after modifying the filter context.
2๏ธโฃ What is the difference between ALL() and REMOVEFILTERS()?
Both can remove filters, but REMOVEFILTERS() clearly communicates that the intention is to remove filters.
3๏ธโฃ What is ALLSELECTED() used for?
It helps calculate results based on the user's selected context while ignoring certain visual-level filters.
4๏ธโฃ What is KEEPFILTERS()?
It preserves existing filters when applying additional filters.
5๏ธโฃ What is context transition?
The conversion of row context into filter context, typically triggered by CALCULATE().
๐งช PRACTICE
Create these measures:
Total Sales
West Sales
Total Sales All Regions
Sales % of Total
Sales % of Selected Regions
Then add:
โ Region slicer
โ Category slicer
โ Sales by Region chart
Change the slicers and observe how each measure behaves.
That observation is one of the best ways to understand DAX filter context.
๐ก Key lesson:
Don't memorize CALCULATE().
Understand what filters exist, which filters you want to change, and what result you expect.
Double Tap โค๏ธ For More
1๏ธโฃ What does CALCULATE() do?
It evaluates an expression after modifying the filter context.
2๏ธโฃ What is the difference between ALL() and REMOVEFILTERS()?
Both can remove filters, but REMOVEFILTERS() clearly communicates that the intention is to remove filters.
3๏ธโฃ What is ALLSELECTED() used for?
It helps calculate results based on the user's selected context while ignoring certain visual-level filters.
4๏ธโฃ What is KEEPFILTERS()?
It preserves existing filters when applying additional filters.
5๏ธโฃ What is context transition?
The conversion of row context into filter context, typically triggered by CALCULATE().
๐งช PRACTICE
Create these measures:
Total Sales
West Sales
Total Sales All Regions
Sales % of Total
Sales % of Selected Regions
Then add:
โ Region slicer
โ Category slicer
โ Sales by Region chart
Change the slicers and observe how each measure behaves.
That observation is one of the best ways to understand DAX filter context.
๐ก Key lesson:
Don't memorize CALCULATE().
Understand what filters exist, which filters you want to change, and what result you expect.
Double Tap โค๏ธ For More
โค9
๐๐ป๐ณ๐ผ๐๐๐ ๐ ๐ผ๐๐ ๐๐๐ธ๐ฒ๐ฑ ๐๐ป๐๐ฒ๐ฟ๐๐ถ๐ฒ๐ ๐ค๐๐ฒ๐๐๐ถ๐ผ๐ป๐ & ๐๐ป๐๐๐ฒ๐ฟ๐๐
โ
โ Real Interview Experiences
โ Company-specific Handbook
โ Interview Process & Preparation Roadmap
โ FREE Preparation Resources
โ
Specialist Programmer :- https://pdlink.in/4xDH2lD
โ
โ Systems Engineer :- https://pdlink.in/4xAhGoL
โ
โInfosys Digital Specialist Engineer :- https://pdlink.in/4yJ98gb
โ
โThe best way to prepare is to learn from candidates who've already been through the process.
โ
โ
โ Real Interview Experiences
โ Company-specific Handbook
โ Interview Process & Preparation Roadmap
โ FREE Preparation Resources
โ
Specialist Programmer :- https://pdlink.in/4xDH2lD
โ
โ Systems Engineer :- https://pdlink.in/4xAhGoL
โ
โInfosys Digital Specialist Engineer :- https://pdlink.in/4yJ98gb
โ
โThe best way to prepare is to learn from candidates who've already been through the process.
โ
โค7
๐ Data Analyst Roadmap โ Part 27
POWER BI LEVEL 6 โ DAX TIME INTELLIGENCE
Time-based analysis is one of the most important things you will do in Power BI.
Businesses commonly ask:
๐ How much did sales grow this month?
๐ How does this year compare with last year?
๐ What was the sales total year-to-date?
๐ Which month had the highest sales?
๐ Are we growing or declining over time?
DAX Time Intelligence helps answer these questions.
๐น 1. You need a proper Date Table
Before using time-intelligence functions, create a dedicated Date table.
Example:
Date =
CALENDAR(
DATE(2024,1,1),
DATE(2026,12,31)
)
Then create useful columns:
โข Year
โข Month
โข Month Number
โข Quarter
โข Year-Month
Sort Month by Month Number so that January โ February โ March โ... โ December instead of alphabetical ordering.
Mark the table as a Date table in Power BI.
๐น 2. Total Sales
Start with a basic measure:
Total Sales =
SUM(Sales[SalesAmount])
This becomes the foundation for most time-based calculations.
๐น 3. Year-to-Date โ TOTALYTD()
YTD means Year To Date. It calculates the cumulative value from the beginning of the year up to the current date.
Example:
Sales YTD =
TOTALYTD(
[Total Sales],
'Date'[Date]
)
If the current month is June, the measure calculates: January + February + March + April + May + June
๐น 4. Previous Year Sales
To compare the current period with the same period last year:
Sales LY =
CALCULATE(
[Total Sales],
SAMEPERIODLASTYEAR('Date'[Date])
)
If the current visual shows March 2026, this measure returns March 2025 sales.
๐น 5. Year-over-Year Growth
Now compare current sales with last year:
YoY Growth =
[Total Sales] - [Sales LY]
YoY Growth % =
DIVIDE(
[Total Sales] - [Sales LY],
[Sales LY]
)
Example:
โข Current Year Sales = โน120 lakh
โข Previous Year Sales = โน100 lakh
โข Growth = โน20 lakh
โข Growth % = 20%
๐น 6. DATEADD()
DATEADD() shifts the current date context.
Previous Month Sales:
Sales Previous Month =
CALCULATE(
[Total Sales],
DATEADD(
'Date'[Date],
-1,
MONTH
)
)
Previous Year:
Sales Previous Year =
CALCULATE(
[Total Sales],
DATEADD(
'Date'[Date],
-1,
YEAR
)
)
You can shift by:
โข DAY
โข MONTH
โข QUARTER
โข YEAR
๐น 7. Month-over-Month Growth
First calculate previous month sales:
Sales PM =
CALCULATE(
[Total Sales],
DATEADD(
'Date'[Date],
-1,
MONTH
)
)
MoM Growth % =
DIVIDE(
[Total Sales] - [Sales PM],
[Sales PM]
)
Example:
โข January = โน10 lakh
โข February = โน12 lakh
โข MoM Growth = 20%
๐น 8. TOTALMTD() and TOTALQTD()
Similar to TOTALYTD():
MTD = Month To Date
Sales MTD =
TOTALMTD(
[Total Sales],
'Date'[Date]
)
QTD = Quarter To Date
Sales QTD =
TOTALQTD(
[Total Sales],
'Date'[Date]
)
So you can analyze:
โข MTD โ current month progress
โข QTD โ current quarter progress
โข YTD โ current year progress
๐น 9. Why Date Tables Matter
Suppose your sales table contains Order Date, Customer, Product, Sales. You could try to perform time calculations directly on Order Date, but a dedicated Date table gives you a consistent calendar for:
โข โ Year
โข โ Quarter
โข โ Month
โข โ Week
โข โ YTD
โข โ MTD
โข โ QTD
โข โ Previous period
โข โ YoY
โข โ MoM
This becomes especially important when working with multiple fact tables.
๐น 10. A Common Mistake
Don't create every time calculation as a calculated column.
Avoid creating separate columns for:
โข Previous Year Sales
โข YTD Sales
โข MoM Growth
โข YoY Growth
These are generally better as measures because they need to respond dynamically to filters and report context.
๐ฏ Interview Questions
1๏ธโฃ What is Time Intelligence in Power BI?
It is the use of DAX functions to perform calculations across dates and periods.
2๏ธโฃ Why do we need a Date table?
It provides a consistent calendar structure for reliable time-based analysis.
3๏ธโฃ What does SAMEPERIODLASTYEAR() do?
It returns the corresponding period from the previous year.
4๏ธโฃ What is the difference between MTD, QTD and YTD?
โข MTD = Month To Date
โข QTD = Quarter To Date
โข YTD = Year To Date
5๏ธโฃ What does DATEADD() do?
It shifts the current date context by a specified number of days, months, quarters, or years.
Double Tap โค๏ธ For More
POWER BI LEVEL 6 โ DAX TIME INTELLIGENCE
Time-based analysis is one of the most important things you will do in Power BI.
Businesses commonly ask:
๐ How much did sales grow this month?
๐ How does this year compare with last year?
๐ What was the sales total year-to-date?
๐ Which month had the highest sales?
๐ Are we growing or declining over time?
DAX Time Intelligence helps answer these questions.
๐น 1. You need a proper Date Table
Before using time-intelligence functions, create a dedicated Date table.
Example:
Date =
CALENDAR(
DATE(2024,1,1),
DATE(2026,12,31)
)
Then create useful columns:
โข Year
โข Month
โข Month Number
โข Quarter
โข Year-Month
Sort Month by Month Number so that January โ February โ March โ... โ December instead of alphabetical ordering.
Mark the table as a Date table in Power BI.
๐น 2. Total Sales
Start with a basic measure:
Total Sales =
SUM(Sales[SalesAmount])
This becomes the foundation for most time-based calculations.
๐น 3. Year-to-Date โ TOTALYTD()
YTD means Year To Date. It calculates the cumulative value from the beginning of the year up to the current date.
Example:
Sales YTD =
TOTALYTD(
[Total Sales],
'Date'[Date]
)
If the current month is June, the measure calculates: January + February + March + April + May + June
๐น 4. Previous Year Sales
To compare the current period with the same period last year:
Sales LY =
CALCULATE(
[Total Sales],
SAMEPERIODLASTYEAR('Date'[Date])
)
If the current visual shows March 2026, this measure returns March 2025 sales.
๐น 5. Year-over-Year Growth
Now compare current sales with last year:
YoY Growth =
[Total Sales] - [Sales LY]
YoY Growth % =
DIVIDE(
[Total Sales] - [Sales LY],
[Sales LY]
)
Example:
โข Current Year Sales = โน120 lakh
โข Previous Year Sales = โน100 lakh
โข Growth = โน20 lakh
โข Growth % = 20%
๐น 6. DATEADD()
DATEADD() shifts the current date context.
Previous Month Sales:
Sales Previous Month =
CALCULATE(
[Total Sales],
DATEADD(
'Date'[Date],
-1,
MONTH
)
)
Previous Year:
Sales Previous Year =
CALCULATE(
[Total Sales],
DATEADD(
'Date'[Date],
-1,
YEAR
)
)
You can shift by:
โข DAY
โข MONTH
โข QUARTER
โข YEAR
๐น 7. Month-over-Month Growth
First calculate previous month sales:
Sales PM =
CALCULATE(
[Total Sales],
DATEADD(
'Date'[Date],
-1,
MONTH
)
)
MoM Growth % =
DIVIDE(
[Total Sales] - [Sales PM],
[Sales PM]
)
Example:
โข January = โน10 lakh
โข February = โน12 lakh
โข MoM Growth = 20%
๐น 8. TOTALMTD() and TOTALQTD()
Similar to TOTALYTD():
MTD = Month To Date
Sales MTD =
TOTALMTD(
[Total Sales],
'Date'[Date]
)
QTD = Quarter To Date
Sales QTD =
TOTALQTD(
[Total Sales],
'Date'[Date]
)
So you can analyze:
โข MTD โ current month progress
โข QTD โ current quarter progress
โข YTD โ current year progress
๐น 9. Why Date Tables Matter
Suppose your sales table contains Order Date, Customer, Product, Sales. You could try to perform time calculations directly on Order Date, but a dedicated Date table gives you a consistent calendar for:
โข โ Year
โข โ Quarter
โข โ Month
โข โ Week
โข โ YTD
โข โ MTD
โข โ QTD
โข โ Previous period
โข โ YoY
โข โ MoM
This becomes especially important when working with multiple fact tables.
๐น 10. A Common Mistake
Don't create every time calculation as a calculated column.
Avoid creating separate columns for:
โข Previous Year Sales
โข YTD Sales
โข MoM Growth
โข YoY Growth
These are generally better as measures because they need to respond dynamically to filters and report context.
๐ฏ Interview Questions
1๏ธโฃ What is Time Intelligence in Power BI?
It is the use of DAX functions to perform calculations across dates and periods.
2๏ธโฃ Why do we need a Date table?
It provides a consistent calendar structure for reliable time-based analysis.
3๏ธโฃ What does SAMEPERIODLASTYEAR() do?
It returns the corresponding period from the previous year.
4๏ธโฃ What is the difference between MTD, QTD and YTD?
โข MTD = Month To Date
โข QTD = Quarter To Date
โข YTD = Year To Date
5๏ธโฃ What does DATEADD() do?
It shifts the current date context by a specified number of days, months, quarters, or years.
Double Tap โค๏ธ For More
โค6๐1
This media is not supported in your browser
VIEW IN TELEGRAM
๐ค New Powerful AI Model: GigaChat 3.5 Reasoning
This open-source LLM actually thinks before it answers! Perfect for complex coding, math, and reasoning prompts.
โ Built on GigaChat 3.5 Ultra: explores multiple step-by-step reasoning paths
โ Automated verification reinforces correct answers, enabling self-correction
โ Autonomously decides when to call external tools or revise earlier steps
โ Highly efficient: Linear attention uses 37% fewer tokens than DeepSeek V4 Flash Preview
๐ Massive benchmark gains over non-reasoning versions:
โข IFBench: 44 โ 77
โข Natural Plan: 64 โ 80
โข LiveCodeBench v6: 56 โ 85
๐ Open-sourced under MIT license. Weights on Hugging Face: fp8 | bf16
This open-source LLM actually thinks before it answers! Perfect for complex coding, math, and reasoning prompts.
โ Built on GigaChat 3.5 Ultra: explores multiple step-by-step reasoning paths
โ Automated verification reinforces correct answers, enabling self-correction
โ Autonomously decides when to call external tools or revise earlier steps
โ Highly efficient: Linear attention uses 37% fewer tokens than DeepSeek V4 Flash Preview
๐ Massive benchmark gains over non-reasoning versions:
โข IFBench: 44 โ 77
โข Natural Plan: 64 โ 80
โข LiveCodeBench v6: 56 โ 85
๐ Open-sourced under MIT license. Weights on Hugging Face: fp8 | bf16
โค5
๐ ๐
๐๐๐ ๐๐๐ ๐๐๐ซ๐ญ๐ข๐๐ข๐๐๐ญ๐ข๐จ๐ง ๐๐จ๐ฎ๐ซ๐ฌ๐๐ฌ ๐
Explore these beginner-friendly courses and strengthen your resume!
๐ฏ Perfect for Students, Freshers and Working Professionals
๐ป Learn Online at Your Own Pace
๐ Earn Certificates After Successful Completion
๐ ๐๐ป๐ฟ๐ผ๐น๐น ๐ณ๐ผ๐ฟ ๐๐ฅ๐๐ ๐:-
https://pdlink.in/45KgqDR
๐ฅ Donโt just collect certificatesโbuild skills that employers value. Share this with your friends!
Explore these beginner-friendly courses and strengthen your resume!
๐ฏ Perfect for Students, Freshers and Working Professionals
๐ป Learn Online at Your Own Pace
๐ Earn Certificates After Successful Completion
๐ ๐๐ป๐ฟ๐ผ๐น๐น ๐ณ๐ผ๐ฟ ๐๐ฅ๐๐ ๐:-
https://pdlink.in/45KgqDR
๐ฅ Donโt just collect certificatesโbuild skills that employers value. Share this with your friends!
๐ Data Analyst Roadmap โ Part 28
POWER BI LEVEL 7 โ DAX ITERATORS: SUMX, AVERAGEX, COUNTX & VIRTUAL CALCULATIONS
You already know functions like "SUM()" and "AVERAGE()". But sometimes a business calculation needs to happen row by row before the final result is calculated. That's where DAX iterators become important.
๐น 1. What is an Iterator?
Iterator functions evaluate an expression for each row of a table and then combine the results.
Common iterators include: "SUMX()", "AVERAGEX()", "COUNTX()", "MINX()", "MAXX()"
๐น 2. SUM() vs SUMX()
Suppose your Sales table has: Quantity, Unit Price. You want total revenue.
With "SUM()", you can directly add a column:
Total Sales = SUM(Sales[SalesAmount])
But if SalesAmount doesn't exist and you need Quantity ร Unit Price you can use "SUMX()":
Total Sales =
SUMX(
Sales,
Sales[Quantity] * Sales[UnitPrice]
)
DAX evaluates: Row 1 โ Quantity ร Price, Row 2 โ Quantity ร Price, Row 3 โ Quantity ร Price, Then adds all the results.
๐น 3. AVERAGEX()
Suppose you want the average revenue generated by each transaction:
Average Sales =
AVERAGEX(
Sales,
Sales[Quantity] * Sales[UnitPrice]
)
The expression is calculated for every row first. Then the average is calculated.
๐น 4. COUNTX()
"COUNTX()" counts the number of non-blank results produced by an expression.
Transactions With Value =
COUNTX(
Sales,
Sales[Quantity] * Sales[UnitPrice]
)
This can be useful when the calculation itself determines whether a value exists. For simply counting rows, however, "COUNTROWS()" is usually clearer:
Transaction Count = COUNTROWS(Sales)
๐น 5. MINX() and MAXX()
You can also find the minimum or maximum value from a calculated expression.
Highest Transaction =
MAXX(
Sales,
Sales[Quantity] * Sales[UnitPrice]
)
Lowest Transaction =
MINX(
Sales,
Sales[Quantity] * Sales[UnitPrice]
)
๐น 6. Iterators Create Row Context
This is one of the most important DAX concepts. Inside:
SUMX(
Sales,
Sales[Quantity] * Sales[UnitPrice]
)
DAX evaluates the expression for the current row. That is called: Row Context.
So: "SUM()" โ directly aggregates a column, "SUMX()" โ evaluates an expression row by row and then aggregates the result
๐น 7. A Practical Profit Example
Suppose your table contains: Quantity, Sales Price, Cost Price. You can calculate total profit without creating a Profit column:
Total Profit =
SUMX(
Sales,
(Sales[SalesPrice] - Sales[CostPrice]) * Sales[Quantity]
)
This is extremely useful because the calculation happens dynamically inside the measure.
๐น 8. Iterators with CALCULATE()
Iterators become even more powerful when combined with "CALCULATE()". For example, you might want to calculate sales only for high-value transactions:
High Value Sales =
SUMX(
FILTER(
Sales,
Sales[SalesAmount] > 10000
),
Sales[SalesAmount]
)
Here: "FILTER()" โ creates the relevant set of rows, "SUMX()" โ evaluates and adds the values. This combination appears frequently in real Power BI projects.
๐น 9. Virtual Tables
DAX can create temporary tables during a calculation. These are called: Virtual Tables. They aren't permanently stored in your model.
For example:
High Value Sales =
CALCULATE(
[Total Sales],
FILTER(
Sales,
Sales[SalesAmount] > 10000
)
)
The filtered table exists only while the calculation is being evaluated.
๐น 10. SUMX() with Related Tables
Iterators can also work with relationships.
Suppose: Product table contains: Product ID, Product Name, Cost. Sales table contains: Product ID, Quantity.
You could calculate total cost using:
Total Cost =
SUMX(
Sales,
Sales[Quantity] * RELATED(Product[Cost])
)
"RELATED()" retrieves the related product cost for the current Sales row. Then "SUMX()" performs the calculation for every sales row.
๐น 11. When Should You Use SUMX()?
Use "SUMX()" when the calculation requires an expression. For example: Quantity ร Price, Quantity ร Cost, Revenue โ Cost, Discount ร Quantity, Price ร Exchange Rate
If the value already exists in a column and you simply need the total, "SUM()" is usually simpler.
๐ฏ Interview Questions
1๏ธโฃ What is an iterator in DAX? - A function that evaluates an expression row by row over a table.
2๏ธโฃ What is the difference between SUM() and SUMX()? - "SUM()" directly aggregates a column, while "SUMX()" evaluates an expression for each row before aggregating.
3๏ธโฃ What does the X in SUMX() represent? - It indicates that the function iterates through rows and evaluates an expression.
4๏ธโฃ What is row context? - The context representing the current row while DAX evaluates an expression.
5๏ธโฃ Can SUMX() work with FILTER()? - Yes. FILTER() can define the rows to process, while SUMX() performs the row-by-row calculation.
๐งช PRACTICE
Create a Sales table containing: Customer, Product, Quantity, Unit Price, Unit Cost
Then create: Total Sales using SUMX(), Total Cost using SUMX(), Total Profit using SUMX(), Average Transaction Value using AVERAGEX(), Highest Transaction using MAXX()
Finally, add: Region slicer, Product slicer, Month slicer. Change the filters and observe how your measures respond.
Power BI Resources: https://t.me/PowerBI_analyst
๐ก Double Tap โค๏ธ For More
POWER BI LEVEL 7 โ DAX ITERATORS: SUMX, AVERAGEX, COUNTX & VIRTUAL CALCULATIONS
You already know functions like "SUM()" and "AVERAGE()". But sometimes a business calculation needs to happen row by row before the final result is calculated. That's where DAX iterators become important.
๐น 1. What is an Iterator?
Iterator functions evaluate an expression for each row of a table and then combine the results.
Common iterators include: "SUMX()", "AVERAGEX()", "COUNTX()", "MINX()", "MAXX()"
๐น 2. SUM() vs SUMX()
Suppose your Sales table has: Quantity, Unit Price. You want total revenue.
With "SUM()", you can directly add a column:
Total Sales = SUM(Sales[SalesAmount])
But if SalesAmount doesn't exist and you need Quantity ร Unit Price you can use "SUMX()":
Total Sales =
SUMX(
Sales,
Sales[Quantity] * Sales[UnitPrice]
)
DAX evaluates: Row 1 โ Quantity ร Price, Row 2 โ Quantity ร Price, Row 3 โ Quantity ร Price, Then adds all the results.
๐น 3. AVERAGEX()
Suppose you want the average revenue generated by each transaction:
Average Sales =
AVERAGEX(
Sales,
Sales[Quantity] * Sales[UnitPrice]
)
The expression is calculated for every row first. Then the average is calculated.
๐น 4. COUNTX()
"COUNTX()" counts the number of non-blank results produced by an expression.
Transactions With Value =
COUNTX(
Sales,
Sales[Quantity] * Sales[UnitPrice]
)
This can be useful when the calculation itself determines whether a value exists. For simply counting rows, however, "COUNTROWS()" is usually clearer:
Transaction Count = COUNTROWS(Sales)
๐น 5. MINX() and MAXX()
You can also find the minimum or maximum value from a calculated expression.
Highest Transaction =
MAXX(
Sales,
Sales[Quantity] * Sales[UnitPrice]
)
Lowest Transaction =
MINX(
Sales,
Sales[Quantity] * Sales[UnitPrice]
)
๐น 6. Iterators Create Row Context
This is one of the most important DAX concepts. Inside:
SUMX(
Sales,
Sales[Quantity] * Sales[UnitPrice]
)
DAX evaluates the expression for the current row. That is called: Row Context.
So: "SUM()" โ directly aggregates a column, "SUMX()" โ evaluates an expression row by row and then aggregates the result
๐น 7. A Practical Profit Example
Suppose your table contains: Quantity, Sales Price, Cost Price. You can calculate total profit without creating a Profit column:
Total Profit =
SUMX(
Sales,
(Sales[SalesPrice] - Sales[CostPrice]) * Sales[Quantity]
)
This is extremely useful because the calculation happens dynamically inside the measure.
๐น 8. Iterators with CALCULATE()
Iterators become even more powerful when combined with "CALCULATE()". For example, you might want to calculate sales only for high-value transactions:
High Value Sales =
SUMX(
FILTER(
Sales,
Sales[SalesAmount] > 10000
),
Sales[SalesAmount]
)
Here: "FILTER()" โ creates the relevant set of rows, "SUMX()" โ evaluates and adds the values. This combination appears frequently in real Power BI projects.
๐น 9. Virtual Tables
DAX can create temporary tables during a calculation. These are called: Virtual Tables. They aren't permanently stored in your model.
For example:
High Value Sales =
CALCULATE(
[Total Sales],
FILTER(
Sales,
Sales[SalesAmount] > 10000
)
)
The filtered table exists only while the calculation is being evaluated.
๐น 10. SUMX() with Related Tables
Iterators can also work with relationships.
Suppose: Product table contains: Product ID, Product Name, Cost. Sales table contains: Product ID, Quantity.
You could calculate total cost using:
Total Cost =
SUMX(
Sales,
Sales[Quantity] * RELATED(Product[Cost])
)
"RELATED()" retrieves the related product cost for the current Sales row. Then "SUMX()" performs the calculation for every sales row.
๐น 11. When Should You Use SUMX()?
Use "SUMX()" when the calculation requires an expression. For example: Quantity ร Price, Quantity ร Cost, Revenue โ Cost, Discount ร Quantity, Price ร Exchange Rate
If the value already exists in a column and you simply need the total, "SUM()" is usually simpler.
๐ฏ Interview Questions
1๏ธโฃ What is an iterator in DAX? - A function that evaluates an expression row by row over a table.
2๏ธโฃ What is the difference between SUM() and SUMX()? - "SUM()" directly aggregates a column, while "SUMX()" evaluates an expression for each row before aggregating.
3๏ธโฃ What does the X in SUMX() represent? - It indicates that the function iterates through rows and evaluates an expression.
4๏ธโฃ What is row context? - The context representing the current row while DAX evaluates an expression.
5๏ธโฃ Can SUMX() work with FILTER()? - Yes. FILTER() can define the rows to process, while SUMX() performs the row-by-row calculation.
๐งช PRACTICE
Create a Sales table containing: Customer, Product, Quantity, Unit Price, Unit Cost
Then create: Total Sales using SUMX(), Total Cost using SUMX(), Total Profit using SUMX(), Average Transaction Value using AVERAGEX(), Highest Transaction using MAXX()
Finally, add: Region slicer, Product slicer, Month slicer. Change the filters and observe how your measures respond.
Power BI Resources: https://t.me/PowerBI_analyst
๐ก Double Tap โค๏ธ For More
โค7
๐๐ฅ๐๐ ๐๐ ๐๐ฎ๐ฟ๐ฒ๐ฒ๐ฟ ๐ ๐ฎ๐๐๐ฒ๐ฟ๐ฐ๐น๐ฎ๐๐ ๐
Join this expert-led masterclass and discover how to become industry-ready for high-growth AI roles.
๐ Date: 24 September 2026
โฐ Time: 7:00 PMโ9:00 PM IST
๐ Mode: Online
๐ Certificate: Available to all attendees
Eligibility :- Graduates Passing In 2025 or earlier
๐ ๐ฅ๐ฒ๐ด๐ถ๐๐๐ฒ๐ฟ ๐ณ๐ผ๐ฟ ๐๐ฅ๐๐ ๐
https://pdlink.in/4xAMeGW
โก Register now and take your first step towards a successful career in AI!
Join this expert-led masterclass and discover how to become industry-ready for high-growth AI roles.
๐ Date: 24 September 2026
โฐ Time: 7:00 PMโ9:00 PM IST
๐ Mode: Online
๐ Certificate: Available to all attendees
Eligibility :- Graduates Passing In 2025 or earlier
๐ ๐ฅ๐ฒ๐ด๐ถ๐๐๐ฒ๐ฟ ๐ณ๐ผ๐ฟ ๐๐ฅ๐๐ ๐
https://pdlink.in/4xAMeGW
โก Register now and take your first step towards a successful career in AI!
โค1
Which DAX function evaluates an expression row by row and then adds the results?
Anonymous Quiz
14%
A) SUM
63%
B) SUMX
11%
C) COUNT
12%
D) CALCULATE
What is the main difference between SUM() and SUMX()?
Anonymous Quiz
1%
A) SUM() works only with text
5%
B) SUMX() works only with dates
93%
C) SUM() aggregates a column, while SUMX() evaluates an expression row by row
1%
D) There is no difference
Which function would you use to calculate the average of a row-level expression?
Anonymous Quiz
21%
A) AVERAGE
55%
B) AVERAGEX
18%
C) AVGX
7%
D) MEANX
What does the "X" in functions such as SUMX() and AVERAGEX() indicate?
Anonymous Quiz
13%
A) The function works only with Excel
69%
B) The function uses row-by-row iteration
7%
C) The function removes filters
11%
D) The function creates a relationship
โค4
๐ ๐ง๐ผ๐ฝ ๐ณ ๐๐ฅ๐๐ ๐ ๐ถ๐ฐ๐ฟ๐ผ๐๐ผ๐ณ๐ ๐๐ผ๐๐ฟ๐๐ฒ๐ ๐๐ผ ๐๐ฒ๐ฎ๐ฟ๐ป ๐๐ฎ๐๐ฎ ๐๐ป๐ฎ๐น๐๐๐ถ๐ฐ๐! ๐
Want to start a career in Data Analytics?
Explore these 7 free Microsoft-backed learning resources covering Power BI, Excel, SQL and data fundamentals
๐ ๐๐ฐ๐ฐ๐ฒ๐๐ ๐๐ต๐ฒ ๐๐ฅ๐๐ ๐๐ผ๐๐ฟ๐๐ฒ๐ ๐
https://pdlink.in/3Tm2D3Z
๐ก Ideal for students, freshers and professionals who want to build practical data skills.
Want to start a career in Data Analytics?
Explore these 7 free Microsoft-backed learning resources covering Power BI, Excel, SQL and data fundamentals
๐ ๐๐ฐ๐ฐ๐ฒ๐๐ ๐๐ต๐ฒ ๐๐ฅ๐๐ ๐๐ผ๐๐ฟ๐๐ฒ๐ ๐
https://pdlink.in/3Tm2D3Z
๐ก Ideal for students, freshers and professionals who want to build practical data skills.
โค4
๐ SQL & Python Quick Cheatsheet for Beginners
๐๏ธ SQL Programming
1. What is SQL?
SQL stands for Structured Query Language. It is used to communicate with databases and work with stored data.
You can use SQL to:
โ Retrieve data
โ Filter data
โ Analyze data
โ Insert data
โ Update data
โ Delete data
2. SELECT
Used to retrieve data from a table.
SELECT โ columns you want
FROM โ table you want data from
To get all columns:
3. WHERE
Used to filter rows.
Common operators:
= Equal
4. AND, OR, NOT
Used to combine conditions.
AND โ both conditions must be true.
OR โ at least one condition must be true.
5. ORDER BY
Used to sort your results.
ASC โ Lowest to highest
DESC โ Highest to lowest
6. DISTINCT
Used to remove duplicate values.
7. LIMIT
Used to restrict the number of rows returned.
Note: Some databases use TOP or FETCH.
8. Aggregate Functions
Used to perform calculations on multiple rows.
COUNT() -- Count
SUM() -- Total
AVG() -- Average
MIN() -- Minimum
MAX() -- Maximum
Example:
9. GROUP BY
Used to create groups and calculate results for each group.
10. HAVING
Used to filter grouped results.
WHERE โ filters rows
HAVING โ filters groups
๐ Python โ Beginner Fundamentals
1. What is Python?
Python is a general-purpose programming language used for:
โ Data Analytics
โ Automation
โ AI & Machine Learning
โ Data Engineering
โ Web Development
2. Variables
Variables store values.
3. Data Types
Important beginner data types:
4. Strings
Strings represent text.
5. Numbers
Python supports integers and floating-point numbers.
6. Boolean
Boolean values represent True or False.
7. Lists
Lists store multiple values in an ordered collection.
Python indexing starts from 0.
8. Dictionaries
Dictionaries store data as key-value pairs.
๐๏ธ SQL Programming
1. What is SQL?
SQL stands for Structured Query Language. It is used to communicate with databases and work with stored data.
You can use SQL to:
โ Retrieve data
โ Filter data
โ Analyze data
โ Insert data
โ Update data
โ Delete data
2. SELECT
Used to retrieve data from a table.
SELECT name, salary
FROM employees;
SELECT โ columns you want
FROM โ table you want data from
To get all columns:
SELECT *
FROM employees;
3. WHERE
Used to filter rows.
SELECT *
FROM employees
WHERE salary > 50000;
Common operators:
= Equal
Greater than
< Less than
= Greater than or equal
<= Less than or equal
<> Not equal
4. AND, OR, NOT
Used to combine conditions.
SELECT *
FROM employees
WHERE salary > 50000
AND department = 'IT';
AND โ both conditions must be true.
SELECT *
FROM employees
WHERE department = 'IT'
OR department = 'HR';
OR โ at least one condition must be true.
5. ORDER BY
Used to sort your results.
SELECT *
FROM employees
ORDER BY salary DESC;
ASC โ Lowest to highest
DESC โ Highest to lowest
6. DISTINCT
Used to remove duplicate values.
SELECT DISTINCT department
FROM employees;
7. LIMIT
Used to restrict the number of rows returned.
SELECT *
FROM employees
LIMIT 10;
Note: Some databases use TOP or FETCH.
8. Aggregate Functions
Used to perform calculations on multiple rows.
COUNT() -- Count
SUM() -- Total
AVG() -- Average
MIN() -- Minimum
MAX() -- Maximum
Example:
SELECT AVG(salary)
FROM employees;
9. GROUP BY
Used to create groups and calculate results for each group.
SELECT
department,
AVG(salary) AS average_salary
FROM employees
GROUP BY department;
10. HAVING
Used to filter grouped results.
SELECT
department,
AVG(salary) AS average_salary
FROM employees
GROUP BY department
HAVING AVG(salary) > 70000;
WHERE โ filters rows
HAVING โ filters groups
๐ Python โ Beginner Fundamentals
1. What is Python?
Python is a general-purpose programming language used for:
โ Data Analytics
โ Automation
โ AI & Machine Learning
โ Data Engineering
โ Web Development
2. Variables
Variables store values.
name = "Alex"
age = 25
salary = 50000
3. Data Types
Important beginner data types:
name = "Alex" # str
age = 25 # int
salary = 50000.5 # float
active = True # bool
type(age)
4. Strings
Strings represent text.
name = "Python"
name.upper() # PYTHON
name.lower() # python
name.strip() # removes spaces
5. Numbers
Python supports integers and floating-point numbers.
age = 25
price = 99.50
10 + 5 # Addition
10 - 5 # Subtraction
10 * 5 # Multiplication
10 / 5 # Division
10 % 3 # Remainder
10 ** 2 # Power
6. Boolean
Boolean values represent True or False.
is_logged_in = True
7. Lists
Lists store multiple values in an ordered collection.
numbers = [10, 20, 30, 40]
numbers[0] # Output: 10
Python indexing starts from 0.
8. Dictionaries
Dictionaries store data as key-value pairs.
โค8
employee = {
"name": "Alex",
"age": 25,
"salary": 50000
}
employee["name"] # Output: Alex9. Tuples
Tuples store ordered values that cannot normally be changed.
coordinates = (10, 20)
10. Sets
Sets store unique values.
numbers = {1, 2, 2, 3}
# Result: {1, 2, 3}SQL Resources: https://whatsapp.com/channel/0029VanC5rODzgT6TiTGoa1v
โค๏ธ Double Tap & React For More!
โค12
๐ ๐๐๐๐จ๐ฆ๐ ๐๐ง ๐๐ ๐๐ง๐ ๐ข๐ง๐๐๐ซ ๐ข๐ง ๐๐๐๐
๐ฏ Choose Your Learning Track:
๐ป Java Full Stack + AI Engineering
๐ MERN Full Stack + AI Engineering
Placement Highlights: โน41 LPA highest package | โน7.4 LPA average package | 2,000+ students placed | 500+ hiring partners
๐ ๐๐ผ๐ผ๐ธ ๐๐ฅ๐๐ ๐๐ฒ๐บ๐ผ ๐๐น๐ฎ๐๐ :- https://pdlink.in/4fWJVID
โก AI is creating new career opportunitiesโstart building the skills companies need in 2026!
๐ฏ Choose Your Learning Track:
๐ป Java Full Stack + AI Engineering
๐ MERN Full Stack + AI Engineering
Placement Highlights: โน41 LPA highest package | โน7.4 LPA average package | 2,000+ students placed | 500+ hiring partners
๐ ๐๐ผ๐ผ๐ธ ๐๐ฅ๐๐ ๐๐ฒ๐บ๐ผ ๐๐น๐ฎ๐๐ :- https://pdlink.in/4fWJVID
โก AI is creating new career opportunitiesโstart building the skills companies need in 2026!
โค6
Learn SQL from basic to advanced level in 30 days
Week 1: SQL Basics
Day 1: Introduction to SQL and Relational Databases
Overview of SQL Syntax
Setting up a Database (MySQL, PostgreSQL, or SQL Server)
Day 2: Data Types (Numeric, String, Date, etc.)
Writing Basic SQL Queries:
SELECT, FROM
Day 3: WHERE Clause for Filtering Data
Using Logical Operators:
AND, OR, NOT
Day 4: Sorting Data: ORDER BY
Limiting Results: LIMIT and OFFSET
Understanding DISTINCT
Day 5: Aggregate Functions:
COUNT, SUM, AVG, MIN, MAX
Day 6: Grouping Data: GROUP BY and HAVING
Combining Filters with Aggregations
Day 7: Review Week 1 Topics with Hands-On Practice
Solve SQL Exercises on platforms like HackerRank, LeetCode, or W3Schools
Week 2: Intermediate SQL
Day 8: SQL JOINS:
INNER JOIN, LEFT JOIN
Day 9: SQL JOINS Continued: RIGHT JOIN, FULL OUTER JOIN, SELF JOIN
Day 10: Working with NULL Values
Using Conditional Logic with CASE Statements
Day 11: Subqueries: Simple Subqueries (Single-row and Multi-row)
Correlated Subqueries
Day 12: String Functions:
CONCAT, SUBSTRING, LENGTH, REPLACE
Day 13: Date and Time Functions: NOW, CURDATE, DATEDIFF, DATEADD
Day 14: Combining Results: UNION, UNION ALL, INTERSECT, EXCEPT
Review Week 2 Topics and Practice
Week 3: Advanced SQL
Day 15: Common Table Expressions (CTEs)
WITH Clauses and Recursive Queries
Day 16: Window Functions:
ROW_NUMBER, RANK, DENSE_RANK, NTILE
Day 17: More Window Functions:
LEAD, LAG, FIRST_VALUE, LAST_VALUE
Day 18: Creating and Managing Views
Temporary Tables and Table Variables
Day 19: Transactions and ACID Properties
Working with Indexes for Query Optimization
Day 20: Error Handling in SQL
Writing Dynamic SQL Queries
Day 21: Review Week 3 Topics with Complex Query Practice
Solve Intermediate to Advanced SQL Challenges
Week 4: Database Management and Advanced Applications
Day 22: Database Design and Normalization:
1NF, 2NF, 3NF
Day 23: Constraints in SQL:
PRIMARY KEY, FOREIGN KEY, UNIQUE, CHECK, DEFAULT
Day 24: Creating and Managing Indexes
Understanding Query Execution Plans
Day 25: Backup and Restore Strategies in SQL
Role-Based Permissions
Day 26: Pivoting and Unpivoting Data
Working with JSON and XML in SQL
Day 27: Writing Stored Procedures and Functions
Automating Processes with Triggers
Day 28: Integrating SQL with Other Tools (e.g., Python, Power BI, Tableau)
SQL in Big Data: Introduction to NoSQL
Day 29: Query Performance Tuning:
Tips and Tricks to Optimize SQL Queries
Day 30: Final Review of All Topics
Attempt SQL Projects or Case Studies (e.g., analyzing sales data, building a reporting dashboard)
Since SQL is one of the most essential skill for data analysts, I have decided to teach each topic daily in this channel for free. Like this post if you want me to continue this SQL series ๐โฅ๏ธ
Share with credits: https://t.me/sqlspecialist
Hope it helps :)
Week 1: SQL Basics
Day 1: Introduction to SQL and Relational Databases
Overview of SQL Syntax
Setting up a Database (MySQL, PostgreSQL, or SQL Server)
Day 2: Data Types (Numeric, String, Date, etc.)
Writing Basic SQL Queries:
SELECT, FROM
Day 3: WHERE Clause for Filtering Data
Using Logical Operators:
AND, OR, NOT
Day 4: Sorting Data: ORDER BY
Limiting Results: LIMIT and OFFSET
Understanding DISTINCT
Day 5: Aggregate Functions:
COUNT, SUM, AVG, MIN, MAX
Day 6: Grouping Data: GROUP BY and HAVING
Combining Filters with Aggregations
Day 7: Review Week 1 Topics with Hands-On Practice
Solve SQL Exercises on platforms like HackerRank, LeetCode, or W3Schools
Week 2: Intermediate SQL
Day 8: SQL JOINS:
INNER JOIN, LEFT JOIN
Day 9: SQL JOINS Continued: RIGHT JOIN, FULL OUTER JOIN, SELF JOIN
Day 10: Working with NULL Values
Using Conditional Logic with CASE Statements
Day 11: Subqueries: Simple Subqueries (Single-row and Multi-row)
Correlated Subqueries
Day 12: String Functions:
CONCAT, SUBSTRING, LENGTH, REPLACE
Day 13: Date and Time Functions: NOW, CURDATE, DATEDIFF, DATEADD
Day 14: Combining Results: UNION, UNION ALL, INTERSECT, EXCEPT
Review Week 2 Topics and Practice
Week 3: Advanced SQL
Day 15: Common Table Expressions (CTEs)
WITH Clauses and Recursive Queries
Day 16: Window Functions:
ROW_NUMBER, RANK, DENSE_RANK, NTILE
Day 17: More Window Functions:
LEAD, LAG, FIRST_VALUE, LAST_VALUE
Day 18: Creating and Managing Views
Temporary Tables and Table Variables
Day 19: Transactions and ACID Properties
Working with Indexes for Query Optimization
Day 20: Error Handling in SQL
Writing Dynamic SQL Queries
Day 21: Review Week 3 Topics with Complex Query Practice
Solve Intermediate to Advanced SQL Challenges
Week 4: Database Management and Advanced Applications
Day 22: Database Design and Normalization:
1NF, 2NF, 3NF
Day 23: Constraints in SQL:
PRIMARY KEY, FOREIGN KEY, UNIQUE, CHECK, DEFAULT
Day 24: Creating and Managing Indexes
Understanding Query Execution Plans
Day 25: Backup and Restore Strategies in SQL
Role-Based Permissions
Day 26: Pivoting and Unpivoting Data
Working with JSON and XML in SQL
Day 27: Writing Stored Procedures and Functions
Automating Processes with Triggers
Day 28: Integrating SQL with Other Tools (e.g., Python, Power BI, Tableau)
SQL in Big Data: Introduction to NoSQL
Day 29: Query Performance Tuning:
Tips and Tricks to Optimize SQL Queries
Day 30: Final Review of All Topics
Attempt SQL Projects or Case Studies (e.g., analyzing sales data, building a reporting dashboard)
Since SQL is one of the most essential skill for data analysts, I have decided to teach each topic daily in this channel for free. Like this post if you want me to continue this SQL series ๐โฅ๏ธ
Share with credits: https://t.me/sqlspecialist
Hope it helps :)
๐19โค8