1.

Types of Operators in DAX?

Answer»

One can create DAX Calculations or queries using formulas which can be used based on need basis and called them as

  • Measures,
  • Calculated Columns,
  • Calculated tables,
  • Row Filters (RLS - Dynamic Row-level Security).

Measures (OR Calculations OR Calculated Measures):

  • Measures are calculations which are created logically (RAM) and are faster than calculated columns, which occupy the space in Power BI Desktop file (PBIX).
  • Will not occupies space unless dragged and dropped in Visuals.
  • These are created in DAX formula bar in Power BI Desktop.
  • It is displayed with Calculator Icon
  • Can also create & maintain individual “Key Measures” table and also folders in the to segregate like in below E.g.

  • We must use functions like Count, Sum, Min, Max, etc. to call any COLUMN for creating measures.

E.g. Net Sales = SUMX(Sales, Sales[Quantity]*Sales[Price])

  • We cannot use measures in Slicer as contains value and will change depending on Context.
  • In the model, measures can also HIDE & unhide on need basis.

Calculated Columns:

  • Calculated Columns are created physically and are slower than calculated measures.
  • These are created in DAX formula bar in Power BI Desktop.
  • We can REFER any column directly to create new column or derive column by using functions like Lookup(), concatenate(), format(),Sum() etc.…
  • Below is example for creating column

E.g. Sales_Column = Sales_[Costs]*Sales_[Qty]

  • We can use Calculated Columns in Slicer.
  • Also, can create relationships between two or more tables.
  • On a need basis, columns can hide & unhide in the model.

Calculated Tables:

  • Calculated Tables can be created like Date Dimension (DimDate) or it can be derived based on existing tables in the model.
  • These are created in DAX formula bar in Power BI Desktop.
  • It also supports to establish relationships between other related tables.
  • These can be hidden or unhide based on the requirement.
  • Below is an example for creating Calendar table using DAX

E.g. DimDate = CALENDAR("01/01/2019","03/31/2019")

Row Filters (RLS – Dynamic Row-level Security):

  • Row Filters also called as Dynamic Row-level Security.
  • This is to filter the records based on Hierarchy.

e.g. You are General Manager of Sales for India and under you have Associate Managers which LOOKS after sales different states in India. So, the requirement is your Associate Managers should be able to see only respective states sales data (not others).

This requirement can be achieved by RLS and need to use a username () – for Names or userprincipalname () – for official Email ids DAX functions.



Discussion

No Comment Found