Notes
Notes
%20Healthcare%20Industry
%20Dynamics/report.pdf
Implicit is when u drag and drop the column in visualization and it automatically selects an
aggregate function like max, min, sum, count, etc
Explicit is when you separately create an aggregate function using dax formula
3) Fact table – Less Information but Pointers to other tables. Tall & narrow
Dimension Table – Contains info about dimension of data from a column in the fact table perspective.
Short and fat table, less rows many columns
Usually many-to-one relation, where fact table is in many side
Category of Functions
1) Columnar function - Usually aggregate functions (SUM, DISTINCTCOUNT, COUNT, etc) Columnar
function, does mot iterate through each row
2) Iterator Function - But if they iterate row by rowIterator Function (SUMX, MINX, etc)
5) Context Modifier - Time Intelligent functions, USERELATIONSHIP, ALL, ALLEXCEPT, DATEADD, etc
Remember Measure does not iterate row by row. Row Context functions
like SUMX, RANKX iterate row by row
DAX Queries
1) Switch
Here true() is used so that after each statement if the logic is valid, then it stops
moving to the next one. Just like Break() in Java
Measured column is not added to the actual table whereas Calculated column becomes
another table. Measure just acts on the table by twisting data
Here’s a tabular comparison of Measures vs. Calculated Columns in DAX:
Can slow down model if too More efficient as it does not take up
Performance
many are created storage
Usage in Filters Can be used in slicers, filters, Cannot be used directly in slicers or
& Slicers and relationships relationships
Golden Rule
If you need a value stored in the table and usable in slicers, use a
calculated column.
If you need a dynamic calculation that adjusts with report filters, use a
measure.
DATE FUNCTIONS
4) TotalMtd, TotalQtd, TotalYtd- needed for cumulative figures
according to dates
Syntax same for all, if you need counting from specific date, explicitly mention as
above
In DatesYTD, also provides cumulative figures but we can use many filter but inside
CALCULATE(). Here two different filter calculated cumulative figure
10) RELATEDTABLE –
👇 Summary Cheats
Use RELATED() when you want to bring one value from a lookup table.
Use RELATEDTABLE() when you want to aggregate or iterate over multiple related
rows.
NB : If ALL is not applied, then all rows will provide rank 1 bcoz the context is the invidual
rows in the overall sales table and not the individual columns. ALL is for filtering in RANKX.
Substitute ALL with ALLSELECTED or ALLEXCEPT according to context
13) ALLSELECTED -
14) LOOKUP – Searches for a item in another table and returns corresponding value.
Sames VLOOKUP.
BUT
No duplicates allowed in powerBi, however if there are duplicate in excel VLOOKUP
fetches the first value
15) KEEPFILTER –
Here 3rd column ignores the filters of accessories, casual wear and only shows
values of Formal.
However with KeepFilter, it respects the filters and blanks out the other rows
16) REMOVEFILTER –
Difference between ALL vs REMOVEFILTER
ALL returns whole column, whereas REMOVEFILTER returns the column needed
But majorly same
Output visual
21) EARLIER
Basically used for cumulative figure. Refers to the previous cell in the specified
column
22) MAX, MAXX
MAX - Can only be used in a column but not on a measure
MAXX – Finds values in all table, and can perform calculations, filter, etc also
23) TOPN
It is used to return the top N rows from a table based on a specified column
Function Description
blanks).
🔹 Example:
Total Sales = SUM(Sales[Revenue])
Function Description
🔹 Example:
Total Sales (Ignoring Filters) = CALCULATE(SUM(Sales[Revenue]), ALL(Sales))
Function Description
🔹 Example:
Total Sales for 2024 = CALCULATE(SUM(Sales[Revenue]), Sales[Year] = 2024)
Function Description
year.
PREVIOUSYEAR /
Returns the previous year or month.
PREVIOUSMONTH
🔹 Example:
Sales Last Year = CALCULATE(SUM(Sales[Revenue]),
SAMEPERIODLASTYEAR(Sales[Date]))
Function Description
🔹 Example:
Category = IF(Sales[Revenue] > 1000, "High", "Low")
Function Description
🔹 Example:
CustomerRegion = RELATED(Customer[Region])
Ranking & Windowing Functions (Used in Advanced BI Reports)
Function Description
🔹 Example:
Rank = RANKX(ALL(Sales), SUM(Sales[Revenue]), , DESC)
VALUES Function
for table
Use aggregator like max(), count() if you want to use it in measure