Power BI Notes
Power BI Notes
Power BI Notes
Can you
explain three important time intelligence functions?
Answer :- In Power BI, time intelligence functions are a set of DAX (Data Analysis
Expressions) functions designed to perform calculations and analysis based on time-
related dimensions. These functions are particularly useful when working with date
or time-based data in Power BI. Here are three important time intelligence
functions in Power BI:
TOTALYTD:
The TOTALYTD function calculates the total for a specified expression year-to-date.
It is commonly used to create cumulative measures for a given period. You can use
it to get a running total of a measure from the beginning of the year up to the
current date.
Example:
DAX
Total Sales YTD = TOTALYTD(SUM(Sales[Amount]), 'Date'[Date])
TOTALMTD:
The TOTALMTD function calculates the total for a specified expression month-to-
date. It is similar to TOTALYTD but works on a monthly basis, providing a running
total from the beginning of the month up to the current date.
Example:
DAX
Total Sales MTD = TOTALMTD(SUM(Sales[Amount]), 'Date'[Date])
SAMEPERIODLASTYEAR:
The SAMEPERIODLASTYEAR function returns a table that contains a parallel period to
the one specified but from the previous year. This is useful for comparing metrics
and identifying year-over-year trends.
Example:
DAX
Sales LY = CALCULATE(SUM(Sales[Amount]), SAMEPERIODLASTYEAR('Date'[Date]))
These functions are just a few examples of the time intelligence functions
available in Power BI. Depending on your specific requirements, you may also use
functions like DATESBETWEEN, DATESINPERIOD, and others to perform various time-
based calculations and comparisons in your Power BI reports and dashboards. Time
intelligence functions help analysts and report developers gain insights into
trends, seasonality, and other time-related patterns in their data.
2.What is the difference between implicit function and explicit function in power
bi ?
Answer :-In the context of Power BI or data analysis tools like DAX (Data Analysis
Expressions), the terms "implicit function" and "explicit function" are not
standard terminologies. However, we can discuss how concepts similar to implicit
and explicit functions might be relevant in this context.
In summary, while the terms "implicit function" and "explicit function" are not
standard in the Power BI context, we can draw parallels to the concepts of implicit
and explicit measures. Implicit measures are created through the tool's interface,
while explicit measures involve writing DAX formulas directly. The choice between
them depends on the complexity of the calculation and the level of control you want
over the logic and expressions used in your Power BI reports and dashboards.
Answer :-In Power BI, calculated columns and calculated measures are both ways to
create new data elements, but they serve different purposes and have distinct
characteristics.
Calculated Columns:
Calculated Measures:
In summary, the key difference between calculated columns and calculated measures
in Power BI is that calculated columns add new columns to the table structure and
are evaluated row by row, while calculated measures provide dynamic calculations
that aggregate or summarize data and are used in reports or visualizations. The
choice between them depends on the nature of the calculation and whether it is
better suited for row-level or aggregate-level operations.
Here are the key concepts to understand how the CALCULATE function works:
Filter Context:
In Power BI, the filter context is the set of filters that are automatically
applied to a calculation based on the report context, such as slicers, filters on
visuals, or row-level security. CALCULATE allows you to temporarily modify this
filter context.
Row Context:
Row context is the context in which a calculation is performed for each row in a
table. When iterating over rows, DAX formulas operate in a row context. CALCULATE
can also be used to modify the row context.
DAX
Total Sales in 2023 = CALCULATE(SUM('Sales'[Amount]), 'Date'[Year] = 2023)
DAX
Profit Margin in 2023 = CALCULATE(
DIVIDE(SUM('Sales'[Profit]), SUM('Sales'[Revenue])),
'Date'[Year] = 2023
)
Context Transition:
CALCULATE also performs a context transition when moving from row context to filter
context. This transition is essential for understanding how filters propagate
through the calculations.
DAX
Total Sales for Each Product = SUMX('Product', CALCULATE(SUM('Sales'[Amount])))
5. How do you handle a scenario where we have missing values or incomplete data
especially when we have to apply time intelligence functions in power bi ?
DAX
Sales Amount (Filled) = IF(ISBLANK('Sales'[Amount]), 0, 'Sales'[Amount])
DAX
Total Sales = CALCULATE(SUM('Sales'[Amount]), 'Calendar'[Date])
Time-aware Aggregations:
Utilize time intelligence functions that automatically handle missing values. For
instance, functions like TOTALYTD or TOTALMTD in Power BI are designed to work with
time-related data and naturally handle missing values by considering the available
data points.
DAX
Total Sales YTD = TOTALYTD(SUM('Sales'[Amount]), 'Date'[Date])
By combining these strategies, you can enhance the robustness of your Power BI
reports and dashboards when dealing with missing values or incomplete data,
especially in the context of time intelligence functions. Choose the approach that
best fits your data and analysis requirements.
6. Suppose,you have three tables in power querry and structure of all those three
tables are similar to each other.Now you went ahead and appended those three
tables.Now if you want to do the close and applyer what will happen all those
initial tables plus that appended table containing the data of all those three
tables will be loaded in power bi but I don't want those three tables to be
loaded,I only want that appended table to be loaded in power bi.So, how will you
manage this?
Answer :-So,in power querry we have option to enable load then from there we have
to check that and then we will close and apply then only that particular marged
querry will be loaded into our power bi data model.
7. Suppose,you have one column and columns contains email ID of different people
and that email ID is like this -nitishkumar@gmail.com for example.Similarly other
email IDs are there.Now if i want to rxtract the first part of that email ID for
example nitish to create the new column which contains the first name then how will
you extract that first name from that email ID column?
Answer :-So,in power query we have in transform tab we have a option to split to
delimeter then by using that split by delimeter we will be passing the delimeter on
which we want to split the column and then we will able to split that column based
upon that delimeter.
8. Have you used index column? So,in what kind of scenario do we use index column?
Answer :- Yes,I have used index column.In my case,my table was not having a primary
key and I wanted to establish a relationship between two tables.So,for that purpose
I have created a index column in my dimension table and then created the
relationship between both that tables using the index columns.
9. Suppose,you want to check if there is any column in a table and you want to
check how many distinct values that column contain,so how can you check that in
power query?
Answer :-In power query,inside the view tab we have to option to check column
profile.After going into that tab we will just click on that particular column and
then we will chek on column quality or column profile then from that we able to get
a summary of our column where we will be able to see how many distinct value our
column is containing and how many total values our column is having.
Question :- If suppose that column contains around 20,000 records and column
profile will show only the top 1000 values. So,according to that top 1000 values it
will tell what is the distinct and all. So how can we see the overall distinct
values if you have to see the overall 20,000 records of that column?
Answer :-
10. Do you know like have you applied merge functionallity?Can you tell me what is
merge?
Answer :-In left anti join,we will get only that record which are presents in the
left table.Basically,we will get the unmatching record from left table means all
the record which are only present in the left table but that is not present in the
right table.
11. How do you differentiate that this table is a fact table or this table is a
dimension table,how do you differentiate that?
Answer :-Generally in fact table there are more number of data presents like there
are there are more number of rows presents and if we see that there are some
columns which are repeating in the table then in that case we will consider that
table as a fact table but what happens in a dimension table data's are not repeated
means we will be getting only the distinct data means distinct rows name we will be
getting in the dimension table.Fact table will be containing the quantitative data
and dimension table will be containing the qualitative data means dimension table
will be having information about any particular dimension.
Answer :-In slope,basically it's a verion of star schema in which dimension table
is further normalized.So,suppose we have a dimension table called product and
inside that product table we have the sub-category of product then for every sub-
category of the product,product name is repeating then in that what will we do we
will create another time dimension table which will be linked to our product
table.So,this is the snowflake schema.
Answer :-Normalization means it's a process to organize the data in our relational
model in such a way that we reduce the data redundency.
Answer :-Cardinality means the represents the relationship between two tables like
how these two tables are related. So,this can be one to one,many to many.
Question :- How will you diffrentiate a donut chart with a pie chart?
Answer :-In pie chart,we have information present in the form of slices while in
the donut chart we have the information present in the form of arcs and in the
donut chart there is a hole inbetween and in pie chart there is no hole
inbetween.So,basically donut cahrt is just a variation of pie chart means it based
upon requirement like what kind of visuals will be suited for our visualization
then in that case we prefer to use donut chat or pie chart.
15. Suppose,you have a slicer and that slicer is present is multiple pages.Now if I
select something in that slicer the same slicer is present in other pages also of
the report. So,if I select something I want that selection should be visible in
other pages of the report also.How it can be made possible?
Answer :-There is option to sync slicers.So,if we enable that option then we will
be able to do this thing.
Answer :-Page level filter like if we apply any filter through filter pin and from
that page if we have applied that filter for any particular page then that filter
will be applied to only particular page and if we go to any other page then that
page will not be affected by this filter.
Question :-Have you set up drill through filter till now in any of your reports?How
do we do that drill through?
Answer :-Yes.Firstly for drill through filter we must have a hierarchy of datalike
if we want to enable drill through for some data column then we must have a
hierarchy of year then month and then date and when we drag and drop that thing on
our then that will be automatically enabled in our visual and there is a fork like
icon available in our visual and if we click on that fork like icon then we will be
able to drill through our visual.
Answer :-Yes.firstly we have to create a new page and in the canvas setting we have
to set that page as a tool tip then for that page we have to enable tool tip and on
the page on any particular visual for which we want to that tool tip to be visual
so we have to link that tool tip to that particular visual then if we hover over
that visual then we will be able to see that tool tip in our visual.
18. What kind of DAX functions you have used till now?
Answer :-To disable a graph that is changing dynamically in Power BI, you can
follow these steps:
Create a button above the visual you want to control. Name the button according to
the visual’s purpose (e.g., “Pie Chart” or “Bar Chart”).
Use the Selection pane to see all the visuals on your report and their visibility
settings.
Click on the visibility icon next to the visual you would like to hide.
To show the visual again, click the button you created for that specific visual.
Note that Power BI allows you to turn off interactions between visuals, which can
be useful when you want to prevent certain visuals from affecting others. To do
this, follow these additional steps:
21. Explain RLS(Row Level Security) and how do you implement RLS in power bi ?
Answer :-In Power BI Desktop, choose File > Publish > Publish to Power BI or select
Publish on the Home ribbon.Sign in to Power BI if you aren't already signed
in.Select the destination. You can search your list of available workspaces to find
the workspace into which you want to publish. The search box lets you filter your
workspaces. Select the workspace, and then click the Select button to publish.When
publishing is complete, you receive a link to your report. Select the link to open
the report in your Power BI site.
Answer :-On the Modeling tab, select Manage relationships > New.In the Create
relationship dialog box, in the first table drop-down list, select a table. Select
the column you want to use in the relationship.In the second table drop-down list,
select the other table you want in the relationship. Select the other column you
want to use, and then select OK.
If you encounter that error, there are a couple ways to fix the issue:
Use Remove Duplicates to create a column with unique values. The drawback to this
approach is that you might lose information when duplicate rows are removed. Often
a key (row) is duplicated for good reason.Add an intermediary table made of the
list of distinct key values to the model, which will then be linked to both
original columns in the relationship.
The first method to edit a relationship is using the Editing relationships in the
Properties pane in Model view, where you can select any line between two tables to
see the relationship options in the Properties pane. Be sure to expand the
Properties pane to see the relationship options.The other method of editing a
relationship is using the Relationship editor dialog, which you can open many ways
from within Power BI Desktop. The following list shows different ways you can open
the Relationship editor dialog.
Select the Modeling ribbon > Manage relationships, then select the relationship and
select Edit.
Select a table in the Fields list then select the Table tools ribbon > Manage
relationships, then select the relationship and then select Edit.
From the Data view, select the Table tools ribbon > Manage relationships, then
select the relationship and then choose Edit.
Select the Home ribbon > Manage relationships, then choose the relationship and
then select Edit.
Double-click any line between two tables.
Right-click any line between two tables and then choose Properties.
Select any line between two tables, then choose Open relationship editor in the
Properties pane.
Answer :-
26.