DAX-1 (4)
DAX-1 (4)
Date type is important. If datatype of any datevalue is text means, u cant extract
month or year from the date. It needs to be described as date datatype
Problem statement:
% change in sales of 4-jan-2025 and 1-jan-2025
%change=(current_year-previous year)/previous_year
U created 3 measures for finding % change. This can be avoided by using variables
Now performance has improved. Because same calculation is not happening multiple
times
Concatenation operator
Comparison operator always returns true or false based on the condition
AND
AND
OR
Concatenation
IN operator
ISBLANK
AND
OR
NOT
TRUE
IF
Conditional column
Explain conditional column and custom column in both DAX and power query editor
Nested IF
SWITCH
AVERAGE
AVERAGEA
AVERAGEX
Important Filter Functions in DAX in Power BI - Slidescope
Filter function never allow you to filter the values from another table though it has
relationship with another table
Calculate vs calculatetable
Filter function and calculatetable function
Calculate function will modify the existing filter context
All function is going to remove all filters that is applied on the visual
All filter will remove the implicit filters as well as explicit filters
ALLEXCEPT
Allexcept keep only one filter mentioned within allexcept function. Ignore any other filters applied on the
page
Find %of contribution of each country in sales amount by occupation?
For that use ALLEXCEPT
Rank function
Filter
When we use direct filter in the calculate function, it will override the filter context. Hence it
display values in all countries irrespective of filter context.
Filter context:
Sometimes u want to modify the filter context
Filter types
Visual level
Page level
Report level
Filter context
1.visual filter/inside filter
2.outside filter
This filtering pipe symbol helps to know what filter u use in your visual
Calculate function
Calculate is the only function which will override the filter context.
We will give filter criteria within the calculate function
Modifying filter context:
Student table
Adding 2 months
Adding 2 months, additioinal criteria
Remove filters
Note: in right side,all months and year are static value but cc group and GL group works as
per filters context
ALL works
Same as remove filters
ALL
AllSelected()
It removes only visual filter and consider outside filter
AllEXCEPT
Running total
Topn
Rankx
Filter
Calculate
Calendar auto dax function
TotalQTD
TotalYTD
TotalMTD
Duplicates
Descending
To highlight the min and max value
For line chart too, Do the same following