Jak Na Power Bi Cheat Sheet
Jak Na Power Bi Cheat Sheet
Jak Na Power Bi Cheat Sheet
Administration
queries under the primary query. In this case, data is placed in columns
› Dataflow—Online Power Query representing
with names that are an exact match. Non-matching columns form new
a special dataset outside of Power BI Desktop.* columns with a unique name in the primary query.
› Application—A single location combining one
In addition to basic visuals, Power BI supports › Use metrics—Usage metrics let you monitor Power BI usage
or more reports or dashboards.* › Custom function—A query intended to apply a pre-defined sequence of creating custom visuals. Custom visuals can be for your organization.
› Admin portal—Administration portal that lets you configure
Drill-through
steps so that the author does not need to create them repeatedly. The › Users—The Users tab provides a link to the Microsoft 365 admin center.
capacities, permissions, and capabilities for individual users custom function can also accept input data (values, sheets, etc.) to be used added using a file import or from a free Marketplace › Audit logs—The Audit logs tab provides a link to the Security &
and workspaces. in the sequence. offering certified and non-certified visuals. Compliance center.
› Parameter—Values independent of datasets. These values can then be › Tenant settings—Tenant settings enable fine-grained control over
*Can be created and edited in the Power BI Service Certification is optional, but it verifies whether, Drill-through lets you pass from a data overview
used in queries. Values enable the quick editing of a model because they features made available to your organization. It controls which features
environment. can be changed in the Power BI Service environment. among other things, a visual accesses external visual to a page with specific details. The target will be enabled or disabled and for which users and groups.
› Data Gateway—On-premises data gateway that lets you services and resources. page is displayed with all the applied filters affecting › Capacity settings—The Power BI Premium tab enables you to
transport data from an internal network or a custom device
to the Power BI Service.
Dataflow the value from which the drill-through originated.
manage any Power BI Premium and Embedded capacities.
› Embed codes—You can view the embed codes that are generated for
your tenant to share reports publicly. You can also revoke or delete codes.
› Power BI Mobile—Mobile app for viewing reports. Mobile
view is applied, if it exists, otherwise the desktop view is used.
The basic unit is a table or Entity consisting of Themes › Organization visuals—You can control which type of Power BI visuals
users can access across the organization.
› Report Server—On-premises version of Power BI Service.
columns or Fields. Just like Queries in Power › Azure connections—You can control workspace-level storage
› Report Builder—A tool for creating page reports. Query, Entities in Dataflows consist of sequences Serves as a single location for configuring all native permissions for Azure Data Lake Gen 2.
of steps. The result of such steps is stored in native › Workspaces—You can view the workspaces that exist in your tenant
graphical settings for visuals and pages. on the Workspaces tab.
Built-in and additional Azure Data Lake Gen 2.
"You can connect a custom Data Lake
› Custom branding—You can customize the look of Power BI for your
whole organization.
languages where the data will be stored." › Protection metrics—The report shows how sensitivity labels help
protect your content.
There are three types of entities: › Featured content—You can manage all the content promoted in the
By default, you can choose from 19 predefined
Built-in languages › Standard entity—It only works with data fetched directly Featured section.
› M/Query Language—Lets you transform data from a data source or with data from non-stored entities themes. Custom themes can be added.
Bookmarks
in Power Query.
› DAX (Data Analysis Expressions)—Lets you define custom
within the same dataflow.
Computed entity*—It uses data from another stored entity
A custom theme can be applied in two different ways:
› Modification of an existing theme—A native window that Bookmarks capture the currently configured view or a
External Tools
calculated tables, columns, and measures in Power BI Desktop. within the same dataflow. lets you modify a theme directly in the Power BI environment. report page visual. Later, you can go back to that state
"Both languages are natively available in Power BI, › Importing a JSON file—Any file you create only defines the They simplify the use of Power BI and extend the
› Linked entity*—Uses data from an entity located in another by selecting the saved bookmark. Setting options:
which eliminates the need to install anything." formatting that should change. Everything else remains the
› Data—Stores filters, applied sort order in visuals and slicers. capabilities offered in Power BI. These tools are
dataflow. If data in the original entity is updated, same. The advantage of this approach is that you can
the new data is directly passed to all By selecting the bookmark, you can re-apply the corresponding mostly developed by the community. Recommended
Additional languages customize any single visual.
settings. external tools:
› Python—Lets you fetch data and create visuals. linked entities.
*Can only be used in a dedicated Power BI Premium workspace. › Display—Stores the state of the display for visuals and › Tabular Editor
Requires installation of the Python language on your "The resulting theme can be exported in the JSON format and report elements (buttons, images, etc.). By selecting the › DAX studio
computer and enabling Python scripting. used in any report without the need to create a theme from
"It supports custom functions as well as parameters." bookmark, you can go back to the previously stored state
› R—Lets you fetch and transform data and create visuals. scratch." of the display. › ALM Toolkit
Requires installation of the R language on your computer
› Current page—Stores the currently displayed page. By › VertiPaq Analyzer
and enabling R scripting.
selecting the bookmark, you can go back the to stored page.
What is Power Query? Data values let expression Custom function Syntax Sugar
Each value type is associated with a literal syntax, a set of values The expression let is used to capture the value from an Example of custom function entries: › Each is essentially a syntactic abbreviation for declaring non-
“An IDE for M development“ of that type, a set of operators defined above that set of values, intermediate calculation in a named variable. These named (x, y) => Number.From(x) + Number.From(y) type functions, using a single formal parameter named.
and an internal type attributed to the newly created values. variables are local in scope to the `let` expression. The Therefore, the following notations are semantically
equivalent:
Components
› Null – null construction of the term let looks like this: (x) =>
› Logical – true, false let let let
› Number – 1, 2, 3, ... name_of_variable = <expression>, out = Number.From(x) + Source = ...,
› Ribbon – A ribbon containing settings and pre-built features by Power › Time – #time(HH,MM,SS) Number.From(Date.From(DateTime.LocalNow()))
addColumn = Table.AddColumn(Source, „NewName“, each [field1] + 1)
Query itself rewrites in M language for user convenience. returnVariable = <function>(name_of_variable) in
› Date – #date(yyyy,mm,ss) in in
› Queries – simply a named M expression. Queries can be moved into addColumn
› DateTime – #datetime(yyyy,mm,dd,HH,MM,SS) returnVariable out ------------------------------------------------------------------------------------------------------------------------------------------------------------------
groups
› DateTimeZone – let
› Primitive – A primitive value is a single-part value, such as a number, When it is evaluated, the following always applies: The input argumets to the functions are of two types: Source = ...,
#datetimezone(yyyy,mm,dd,HH,MM,SS, 9,00)
logical, date, text, or null. A null value can be used to indicate the absence › Required – All commonly written argumets in (). Without add1ToField1 = (_) => [field1] + 1,
of any data. › Duration – #duration(DD,HH,MM,SS) › Expressions in variables define a new range containing
these argumets, the function cannot be called. addColumn(Source,“NewName“,add1ToField1)
› List – The list is an ordered sequence of values. M supports endless lists. › Text – “text“ identifiers from the production of the list of variables and must in
› Optional – Such a parameter may or may not be to function to
Lists define the characters “{“ and “}“ indicate the beginning and the end of › Binary – #binary(“link“) be present when evaluating terms within a list variables. The
enter. Mark the parameter as optional by placing text before The second piece of syntax sugar is that bare square brackets are syntax
the list. › List – {1, 2, 3} expressions in the list of variables are they can refer to each
the argument name “Optional“. For example (optional x). If it sugar for field access of a Record named `_`.
› Record – A record is a set of fields, where the field is a pair of which form › Record – [ A = 1, B = 2 ] other
the name and value. The name is a text value that is in the field record does not happen fulfillment of an optional argument, so be the
unique.
› Table – A table is a set of values arranged in named columns and rows.
› Table – #table({columns},{{first row contenct},{}…})*
› Function – (x) => x + 1
› All variables must be evaluated before the term let is evaluated.
› If expressions in variables are not available, let will not be
same for for calculation purposes, but its value will be null. Query Folding
Optional arguments must come after required arguments.
Table can be operated on as if it is a list of records, or as if it is a record of
› Type – type { number }, type table [ A = any, B = text ] evaluated
* The index of the first row of the table is the same as for the records in sheet 0 › Errors that occur during query evaluation propagate as an error As the name implies, it is about composing. Specifically, the
lists. Table[Field]` (field reference syntax for records) returns a list of values in Arguments can be annotated with `as <type>` to indicate
that field. `Table{i}` (list index access syntax) returns a record representing a to other linked queries. steps in Power Query are composed into a single query, which
required type of the argument. The function will throw a type
row of the table. is then implemented against the data source. Data sources
› Function – A function is a value that when called using arguments creates a Operators error if called with arguments of the wrong type. Functions can
that supports Query folding are resources that support the
new value. Functions are written by listing the function argumets in
parentheses, followed by the transition symbol “=>“ and the expression
Conditions also have annotated return of them. This annotation is provided
as:
concept of query languages as relational database sources.
There are several operators within the M language, but not every This means that, for example, a CSV or XML file as a flat file
defining the function. This expression usually refers to argumets by (x as number, y as text) as logical => <expression>
name. There are also functions without argumets.
operator can be used for all types of values. Even in Power Query, there is an “If“ expression, which, based with data will definitely not be supported by Query Folding.
› Parameter – The parameter stores a value that can be used for › Primary operators on the inserted condition, decides whether the result will be a The return of the functions is very different. The output can be a Therefore, the transformation does not have to take place
transformations. In addition to the name of the parameter and the value it › (x) – Parenthesized expression true-expression or a false-expression. sheet, a table, one value but also other functions. This means until after the data is loaded, but it is possible to get the data
stores, it also has other properties that provide metadata. The undeniable › x[i] – Field Reference. Return value from record, list of values that one function can produce another function. Such a function ready immediately. Unfortunately, not every source supports
Syntactic form of If expression:
advantage of the parameter is that it can be changed from the Power BI from table. is written as follows: this feature.
Service environment without the need for direct intervention in the data if <predicate> then < true-expression > else < false-expression >
› x{i} – Item access. Return value from list, record from table. › Valid functions
set. Syntax of parameter is as regular query only thing that is special is that “else is required in M's conditional expression “ let first = (x)=> () => let out = {1..x} in out in first
“Placing the “?“ Character after the operator returns null if the › Remove, Rename columns
the metadata follows a specific format.
index is not in the list “ Condition entry: When evaluating functions, it holds that: › Row filtering
› Formula Bar – Displays the currently loaded step and allows you to edit › Grouping, summarizing, pivot and unpivot
› x(…) – Function invocation If x > 2 then 1 else 0 › Errors caused by evaluating expressions in a list of
it.To be able to see formula bar, It has to be enabled in the ribbon menu › Merge and extract data from queries
inside View category. › {1 .. 10} – Automatic list creation from 1 to 10 If [Month] > [Fiscal_Month] then true else false expressions or in a function expression will propagate › Connect queries based on the same data source
› Query settings – Settings that include the ability to edit the name and › … – Not implemented If expression is the only conditional in M. If you have multiple further either as a failure or as an “Error“ value › Add custom columns with simple logic
description of the query. It also contains an overview of all currently applied › Mathematical operators – +, -, *, / predicates to test, you must chain together like: › The number of arguments created from the argument › Invalid functions
steps. Applied Steps are the variables defined in a let expression and they › Comparative operators › Merge queries based on different data sources
if <predicate> list must be compatible with the formal argumets of
are represented by varaibles names. › Adding columns with Index
› > , >= – Greater than, greater than or equal to then < true-expression > the function, otherwise an error will occur with reason
› Data preview – A component that displays a preview of the data in the › Change the data type of a column
currently selected transformation step.
› < , <= – Less than, less than or equal to else if <predicate> code “Expression.Error“
› = , <> – is equal, is not equal. Equal returns true even for then < false-true-expression >
DEMO
› Status bar – This is the bar located at the bottom of the screen. The row
contains information about the approximate state of the rows, columns,
and time the data was last reviewed. In addition to this information, there is
null = null
› Logical operators
else < false-false-expression >
When evaluating the conditions, the following applies:
Recursive functions
profiling source information for the columns. Here it is possible to switch › and – short-circuiting conjunction › Operators can be combined. For example, as follows:
the profiling from 1000 rows to the entire data set. › or – short-circuiting disjunction › If the value created by evaluating the if a condition is not a For recursive functions is necessary to use the character “@“
logical value, then an error with the reason code
› LastStep[Year]{[ID]}
› not – logical negation which refers to the function within its calculation. A typical
*This means that you can get the
Functions in Power Query › Type operators “Expression.Error„ is raised recursive function is the factorial. The function for the factorial
value from another step based on the index of the column
› as – Is compatible nullable-primitive type or error › A true-expression is evaluated only if the if condition can be written as follows:
Knowledge of functions is your best helper when working with › is – Test if compatible nullable-primitive type evaluates to true. Otherwise, false-expression is evaluated. let › Production of a DateKey dimension goes like this:
a functional language such as M. Functions are called with › Metadata - The word meta assigns metadata to a value. › If expressions in variables are not available, they must not be Factorial = (x) => #table(
parentheses. Example of assigning metadata to variable x: evaluated if x = 0 then 1 else x * @Factorial(x - 1), type table [Date=date, Day=Int64.Type, Month=Int64.Type,
› Shared – Is a keyword that loads all functions “x meta y“ or “x meta [name = x, value = 123,…]“ › The error that occurred during the evaluation of the condition Result = Factorial(3) MonthName=text, Year=Int64.Type,Quarter=Int64.Type],
(including help and example) and enumerators in Within Power Query, the priority of the operators applies, so for example will spread further either in the form of a failure of the entire in List.Transform(
result set. The call of function is made inside empty “X + Y * Z“ will be evaluated as “X + (Y * Z)“ query or “Error“ value in the record. Result // = 6 List.Dates(start_date, (start_date-endd_ate),
query using by = # shared #duration(1, 0, 0 ,0)),
each {_, Date.Day(_), Date.Month(_),
Comments The expression try… otherwise Each Date.MonthName(_), Date.Year(_), Date.QuarterOfYear(_)}
))
Functions can be divided into two categories: Capturing errors is possible, for example, using the try Functions can be called against specific arguments. However, if
M language supports two versions of comments:
› Prefabricated – Example: Date.From() expression. An attempt is made to evaluate the expression
Keywords
› Single-line comments – can be created by // before code the function needs to be executed for each record, an entire
› Custom – these are functions that the user himself prepares after the word try. If an error occurs during the evaluation, the sheet, or an entire column in a table, it is necessary to append
for the model by means of the extension of the notation by › Shortcut: CTRL + ´ expression after the word otherwise is applied the word each to the code. As the name implies, for each
„()=> “, where the argumets that will be required for the › Multi-line comments – can be created by /* before code and and, as, each, else, error, false, if, in, is, let, meta, not,
Syntax example: context record, it applies the procedure behind it. Each is never
evaluation of the function can be placed in parentheses. */ after code otherwise, or, section, shared, then, true, try, type, #binary,
try Date.From([textDate]) otherwise null required! It simply makes it easier to define a function in-line
When using multiple argumets, it is necessary to separate › Shortcut: ALT + SHIFT + A #date, #datetime, #datetimezone, #duration, #infinity, #nan,
for functions which require a function as their argument.
them using a delimiter. #sections, #shared, #table, #time