Add calculated tables and columns to Power BI Desktop models Flashcards
What is a calculated table in Power BI?
A table created using a DAX formula that generates new tables within the model.
When should you use calculated tables?
When you need intermediate tables to simplify complex calculations or to create static tables for the model.
How do you create a calculated table in Power BI?
By using the New Table feature and writing a DAX formula to define the table’s content.
Give an example of a DAX formula for creating a calculated table.
Sales Summary = SUMMARIZE(Sales, Sales[Product], “Total Sales”, SUM(Sales[Sales Amount]))
What is the first step to create a calculated column in Power BI?
Ensure the table in Data view is selected, then use the “New column” option in the Table tools ribbon.
How do you create a fiscal year calculated column in DAX?
Due Fiscal Year = “FY” & YEAR(‘Due Date’[Due Date]) + IF(MONTH(‘Due Date’[Due Date]) > 6, 1)
How can you define a calculated column for fiscal quarters?
Due Fiscal Quarter = ‘Due Date’[Due Fiscal Year] & “ Q” & IF(MONTH(‘Due Date’[Due Date]) <= 3, 3, IF(MONTH(‘Due Date’[Due Date]) <= 6, 4, IF(MONTH(‘Due Date’[Due Date]) <= 9, 1, 2)))
What DAX formula converts a date to “yyyy mmm” format?
Due Month = FORMAT(‘Due Date’[Due Date], “yyyy mmm”)
How do you create a MonthKey column in Power BI?
MonthKey = (YEAR(‘Due Date’[Due Date]) * 100) + MONTH(‘Due Date’[Due Date])
What is row context in DAX?
Row context refers to the current row being evaluated in a table, allowing calculations to be performed on a row-by-row basis.
How is row context automatically applied in DAX?
It is automatically applied in calculated columns and row-level calculations in tables.
Can row context be applied to measures?
No, row context cannot be directly applied to measures, which work with filter context.
How can row context be created in a measure?
By using functions like SUMX, FILTER, and RELATED, which iterate over rows.
What are the three techniques to add columns to a model table in Power BI?
- Add columns to a view or table in a relational database.
- Add custom columns using M in Power Query.
- Add calculated columns using DAX in model tables.
Why is it recommended to add custom columns in Power Query?
They load to the model in a more compact and optimal way.