2022-09-18T14:18:25+03:00[Europe/Moscow] en true <p>Types of DAX Formulas: </p>, <p>Goal of Measures </p>, <p>Conventions for Measure</p>, <p>How you refer to a Field from a table ?</p>, <p>what is the ROW Context in DAX ?</p>, <p>what is the Filter Context in DAX ?</p>, <p>important notes about context in DAX </p>, <p>RELATED function </p>, <p>ROUND</p>, <p>We do not want to use Calculated Column results in Pivot Table using Implicit Measures</p>, <p>Explicit DAX Measure benefits ?</p>, <p>For Efficient Data Model Pivot Table Reporting Results, it is best to</p>, <p>If you have a Relationship between a Fact Table and a Dimension Table and there are unmatched items on the Many Side of the Relationship</p>, <p>Why do we drag the filter criteria from D tables </p>, <p>Considerations when choosing between the two Calculated column VS Measures </p>, <p>Why We Need a Date Table. Why we do NOT use the Automatic Grouping Feature for a Data Model Pivot Table </p>, <p>Date Table characteristics ?</p>, <p>Main usage of CALCULATE function </p>, <p>What is the context transition concept ?</p>, <p>How to use the DAX to create dynamic tittle </p>, <p>In DAX Studio, we can</p>, <p>How to check the accuracy of DAX formula in Excel ?</p>, <p>what does DAX table formulas produce ?</p>, <p>how to create date table in PBI and PP ?</p>, <p>How to do a Rolling 12 month back in DAX ?</p>, <p>What does the granularity means ?</p>, <p>In PBI, how do we edit the interaction between the visuals ?</p>, <p>What is the granularity means in DAX ?</p>, <p>Why we shouldn't is a MEASURE inside a measure that iterate over F table ?</p>, <p>In DAX studio, how do we EVALUATE a measure ?</p>, <p>What does VALUES table function do in DAX ?</p>, <p>What does CROSSJOIN table function do in DAX ?</p>, <p>How to do the rolling 12 months back trick in DAX ?</p>, <p>What does the grain means ?</p>, <p>When will the difference in values become apparent when using average <span class="tt-bg-red">daily</span> rev ?</p>, <p>When will the difference in values become apparent when using average <span class="tt-bg-red">Monthly</span> rev ?</p>, <p>VALUES DAX function, what does it deliver ?</p> flashcards
DAX

DAX

  • Types of DAX Formulas:

    1. Calculated Column (physical column added to table in data model that has a calculation Row By Row

    Used to Calculate:

    i. Numbers in a Fact Table, like Revenue in a Sales Transaction Table (2 step calculation )

    ii. Attributes in a Dimension Table, like Fiscal Year in a Date Table

    iii. Helper Columns

    )

    2. Measures (structure that produce a single value and can include

    A- delusive calculated column that iterate on a table then deliver a value (1 step calculation )

    B- internal filter context

    c- other measures )

    3. Table Formulas that deliver a table of values. Example: the DAX Table Function

    CALCULATETABLE.

  • Goal of Measures

    i. Measuring the health or performance of Entity

    ii. Examples:

    1. Total Revenue

    2. Ave Daily Revenue

    3. Customer Retention Rate

    4. % Crime Type in a Neighborhood

  • Conventions for Measure

    The Convention is to create Measure below the Fact Table

  • How you refer to a Field from a table ?

    Table[Field Name]

  • what is the ROW Context in DAX ?

    Row context = The Column References in the formula are able to “see” the values for each row in the table and make the correct calculation for each row.

  • what is the Filter Context in DAX ?

    DAX Measures & Filter Context:

    1. For a Dimension Table Filter:

    i. Criteria from Row, Column, Filter & Slicer Areas filter the underlying

    Dimension Tables

    ii. The Filter Flows Across the Relationship

    iii. The Fact Table is filtered down to a smaller size

    iv. DAX Measure calculates over a smaller column

  • important notes about context in DAX

    1- whenever you add a column in a table and use a normal formula = row context

    2- when you drag and item from D table in PT or matrix = filter context why ?,

    because we have already dragged a MEASURE in Values ares so this MEASURE sees all filters from (ROW/COLUMNS criteria, filter area, slicer area)

    3- if you want a primary key or foreign key to flow in the function that iterate over it = use the function with calculate or mention the measure name (context transition

  • RELATED function

    The function that we use in DAX to look up an item from the Many Side of a Relationship to retrieve an item from the One Side of the Relationship.

  • ROUND

    The function that we use in DAX to round numbers

  • We do not want to use Calculated Column results in Pivot Table using Implicit Measures

    After we create a Calculated Column for an amount like Revenue, we do not want to drag and drop the Column (Field) from a Pivot Table Field List into the Values Area of Pivot Table because it creates an Implicit Measure that is not an efficient (details ahead in the section on Explicit vs. Implicit Measures).

  • Explicit DAX Measure benefits ?

    i. You choose what functions go into your Measure.

    ii. You can name the Measure.

    iii. Furthermore, you can apply Number Formatting to the Measure.

    iv. also, , You can use the formula over and over

  • For Efficient Data Model Pivot Table Reporting Results, it is best to

    1. Hide all Columns (Fields) in the Fact Table.

    2. List Only Measures in the Fact Tables.

    3. Use Columns for filtering from the Dimension Tables.

  • If you have a Relationship between a Fact Table and a Dimension Table and there are unmatched items on the Many Side of the Relationship

    When you use a Dimension Table Column as a filter in a PivotTable or visualization, a blank will show up in the PivotTable indicating that there is an unmatched item.

  • Why do we drag the filter criteria from D tables

    i. DAX Formulas work more efficiently on the smaller Dimension Tables

    ii. DAX Formulas are designed to have the Dimension Tables filtered and then have the

    filter flow through the Relationship to the Fact Table to create a smaller set of values for

    the DAX Formula to use.

  • Considerations when choosing between the two Calculated column VS Measures

    If the calculation time is too slow when the Measure is dropped into the Pivot Table or a condition is changed, then you might want to consider using a Calculated Column to calculate the Row-by-Row Revenue Numbers.

  • Why We Need a Date Table. Why we do NOT use the Automatic Grouping Feature for a Data Model Pivot Table

    1. Date Table Provides Date Attributes that we can use as Filters for our Reports

    2. when we need to create a periodic measure like AVg DAILY REV

    3. We need the benefit of having a Dimension Table that can filter the Fact Table (so DAX Formulas can calculate over a smaller set of numbers)

    4. Time Intelligence Functions (like TOTAL YTD, SAMEPERIODLASTYEAR and DATE ADD) require a Date Table.

  • Date Table characteristics ?

    1. Unique List in First Column for every possible day for every given year in the Date Column in the

    Fact Table (so Time Intelligence Functions work correctly, like for DATEADD function)

    2. Must Mark as Date Table (So Automatic Grouping Feature in Data Model will be disabled).

  • Main usage of CALCULATE function

    1- context transition

    2- apply internal filter context on the measure

  • What is the context transition concept ?

    Letting the Primary Key or row/column criteria to flow in the function and to allow filtering before the aggregation

  • How to use the DAX to create dynamic tittle

    1- right like the below function

    Dashboard Label:="Boomerang Inc. Metrics for the Years: "&MIN(dDate[Year])&" to "&MAX(dDate[Year])

    2- create a new PT using it only

    3- convert to function from OLAP

    4- mix the function then put it in the right place

  • In DAX Studio, we can

    1. Build Formulas

    2. Visualize DAX Table Functions.

    3. Format our DAX.

    4. Time our Formulas.

  • How to check the accuracy of DAX formula in Excel ?

    1. Build your DAX Table Formula using DAX Studio.

    2. Copy the DAX Code from DAX Studio.

    3. In Excel go to the Data Ribbon Tab, then in the Get and Transform group click the Existing

    Connections button.

    4. In the Existing Connections dialog box, click the Table tab, then select a table from the data

    model or a query for one of the dimension tables, then click Open

    5. With the table delivered to the Excel Sheet, Right-click the Table, then in the list of options,

    point to Table, then from the second list of options, click on Edit DAX.

    6. In the Edit DAX dialog box, from the Command Type dropdown, select DAX

    7. In the Expressions textbox, Paste your DAX Table Formula.

    8. Click OK.

  • what does DAX table formulas produce ?

    i. Table formulas, like CALENDAR, CALCULATETABLE and FILTER deliver a table of values.

    ii. Examples:

    1. The DAX Table Function CALCULATETABLE can be used in a Measure.

    2. The DAX Table Function CALENDAR can be used to create a Date Table.

  • how to create date table in PBI and PP ?

    PP => built in feature ( manually update the range whenever new data comes in the F table

    PBI => formula

    dDate = CALENDAR(DATE(YEAR(MIN(fTransactions[Date])),1,1),DATE(YEAR(MAX(fTransactions[Date])),12,31))

    Note: always sort the month name based on month number

    Always mark dDate as date table

  • How to do a Rolling 12 month back in DAX ?

    = CALCULATE([AVG Trans Rev],DATESINPERIOD(dDate[Date],LASTDATE(dDate[Date]),-1,YEAR))

    DATESINPERIOD DAX function to generate a list of valid dates for the Measure ( internal filter context)

  • What does the granularity means ?

    It refers to the level of table (transactional level, daily level, monthly level etc.)

    Note:

    1- always we need to make sure about what is the level of the table that we need to use before starting the measure (in iterator functions)

  • In PBI, how do we edit the interaction between the visuals ?

    Click on any chart / table → format → edit interactions

  • What is the granularity means in DAX ?

    Level of the details in the table (transactional level, Daily level, Monthly level)

  • Why we shouldn't is a MEASURE inside a measure that iterate over F table ?

    1- will take too much time because in each row in F table the measure will iterate the whole F table

    1- avoid double counting in case there are multiple rows in F table with some details

  • In DAX studio, how do we EVALUATE a measure ?

    Use ROW function

  • What does VALUES table function do in DAX ?

    Create a unique list of items as table

    = VALUES(ddate[Year]

  • What does CROSSJOIN table function do in DAX ?

    Create a table that is cross join from 2 or more tables (this means the values inside the cross join function should be tables, that is why we used also VALUES because it delivers a table as result)

    example :

    = CROSSJOIN (VALUES(ddate[Year]),VALUES(ddate[Month])

  • How to do the rolling 12 months back trick in DAX ?

    Imply an internal filter context with CALCULATE function so when ever a date flow into the MEASURE it takes the mentioned period in the filter context

    internal filter context

    DATESINPERIOD(dDate[Date],LASTDATE(dDate[Date]),-1,YEAR)

  • What does the grain means ?

    Level of details

    ex : when the table made based on transaction level or date table made based on daily level

  • When will the difference in values become apparent when using average daily rev ?

    In Month total level

  • When will the difference in values become apparent when using average Monthly rev ?

    In Year total level

  • VALUES DAX function, what does it deliver ?

    - A unique list of items in specific column ex VALUES(dDate[Year Month])

    A unique with no duplicate rows ex VALUES(dDate)

    - A unique list of items in the Pivot table or current filter context ( could be slicer for example )

    (when we need to list the products for example for each sales Rep) use it along with concatenateX function

    CONCATENATEX(VALUES(fTransactions[Product]),fTransactions[Product]," - ")