Two slicers and each slicer affect one column each in a table using powerbi - powerbi

I have a project that involves building a dashboard using power bi. It is composed of a table with three columns: company name, total revenue, and revenue change %. These are the following requirements.
Create two slicers.
The first slicer must only slice the revenue column.
The second slicer must slice the revenue change % column.
When you slice the first column, the other column must remain static. This is also the same when you do it with the second slicer.
I have tried a lot of options like using the parameter field but I cannot find any solution for the requirements. I have known that a slicer affects the whole table, and not just one.
Do you have any suggestions as to what I will do to meet the requirement of the project?

Related

Measure inside Calculated Column; but measure depends on slicer selection

I have a tricky situation in Microsoft Power BI, and DAX language:
I am developing a new Calculated Column called Status_CC in a table called Customers; we refer to this formally as - Customers[Status_CC].
This calculated column (Customers[Status_CC]) has a number of conditions in its derivation, I am using SWITCH statement to develop it.
i.e.
Status_CC = SWITCH(
TRUE(),
.........
)
One of the conditions to develop the this Customers[Status_CC] calculated column is: Customers[HireDate] > [BonusDate].
The intersting part is, HireDate is an existing column in the Customers table.
However, [BonusDate] is a measure; this measure is developed using another table called WorkHistory.
A column (called PayCategory) from the WorkHistory table acts as a slicer in the report visual. The PayCategory column determines the value of the [BonusDate] measure.
I am using the DAX function ALLSELECTED on the slicer - the WorkHistory table's PayCategory column, to develop the [BonusDate] measure.
My question is, will the calculated column Customers[Status_CC] work correctly, if it depends on the [BonusDate] measure, which in turn depends on another table WorkHistory, which feeds PayCategory that acts as a slicer ?
I don't see any syntax error in Customers[Status_CC], but not sure whether the numbers are right.
My final report visual in Power BI Report View has:
-several columns from the Customers table, including the calculated column Customers[Status_CC]
-a slicer with PayCategory from the WorkHistory table that dictates the value of the [BonusDate] measure.
Any advice, please?
Measures used in calculated columns are calculated at model refresh time for each row. The row context is transformed to a filter context during the calculation of the measure, and is the only active filter for the measure calculation. So no report filters or slicers would be active at that point.
Note for that non-measure expressions the row context is not transformed to a filter context, so you would see a global total on each row, unless you explicitly use calculate which always changes the row context into a filter context.

Add customizable date range comparisons to a Power BI Table

I am trying to recreate a Tableau table view in Power BI where I can compare two customizable date ranges and show the percent differences across metrics as a calculated row.
Reference Screenshot from Tableau
In practice, my table will have 3 rows: 1 row for each time period selected and a row for the percent difference. The percent difference row is a nice to have, not a need. All my table metrics are coming from the same source.
I also need to set up two different date slicers that each row of my table will reference. I've played around a little with setting up a separate date table for the comparison period to be selected from, following this thread: Comparing Data Across Date Ranges
The challenge now is showing two separate periods in the same table.
Appreciate any guidance!

Totals in table visual is not shown in power BI

I'm using powerbi desktop version and I've added a measure as a column in the table visual.
Enabled totals as well but unfortunately I'm not able to see the total value of that particular column to be displayed.
The same table contains several other measures for which the total appears but not for one particular column. This has data type decimal number.
Any suggestions?
TIA!!!

In Power BI, how can I create a column that changes based on a slicer and visualization?

I'm pretty new to Power BI. I'm unsure how to approach this.
I have one visualization that displays the ten most frequently bought products in a time frame that is set by a slicer. In another visualization, I display how those products have been selling over the past few years (this time frame is not determined by the slicer). I want to display only the ten products that come from the first visualization, not the ten most common over the time frame in the second visualization.
How can I accomplish this? The approach I have in mind (and I'm open to others) is to create a true/false column that changes with the first visualization. "True" would be for products that are frequently bought as determined by the first visualization in the slicer-determined time range, and the second visualization would only look at values with a "true" in that column. How can I create a column (or table, maybe?) that changes depending on a visualization?
Clarification: most of the pages will say Top10 ... Actually, the measure used was a simple Top5 that includes products with the same number of orders than the 5th product. Therefore, to avoid dealing with larger images, 7 products will be seen but it is a Top5 ranking. The idea is you can replace it with your custom TopN measure.
What I understood:
The simplification of your model plus the disconnected help table would be:
I have one visualization that displays the ten most frequently bought
products in a time frame that is set by a slicer.
The Date slicer belongs to the Dates table in the Data model.
The table viz represents the number of rows in the sales table in the
current context (for each product within the Date range).
The table viz is sorted according to the [#Rows] measure in descending
order.
The table viz only presents the TopN products even without the presence
of the [#Rows] measure due to the presence of the [TopOrders]
measure within Filters on this visual. [TopOrders] is 1.
On the second page you create:
A slicer with the Dates[Date] column (the same one used on the
previous page).
A matrix with Products[ProductName] on the rows, HDates[Year] on
the columns, and a measure on values.
From the View tab, you select the Sync Slicers option.
Inside the Sync Slicers pane:
In the Sync column, check the boxes related to the necessary pages.
In the Display column uncheck the box that contains the over
years report.
So far all we have done is pass the time frame context from page 1 to page 2.
Since the TopN context depends on the time frame context, we can now use the [TopOrders] measure as a Filters on this visual in the matrix. Again, [TopOrders] is 1.
Why do the numbers differ between rows and not between columns?
Also, in this example, the Sales table only has information up to 12/31/2020 but the visualization shows an additional year and the Sales[Amount] values for each order is $1 so that [#Orders] and [SalesAmount] are the same for easy comparison.
HDates is not related to the model and for each combination of HDates[Year]-Products[ProductName], the [SalesAmount] measure is using the information coming from the previously hidden slicer and the respective Products[ProductName] because the information coming from HDates[Year] has no effect yet.
In order to complete this exercise, it only remains to modify the [SalesAmount] measure in such a way that it removes the filter on the time frame (Dates[Date]) and it recognizes HDates[Year] as Dates[Year].
SalesAmount :=
CALCULATE(
SUM(Sales[Amount]),
ALL(Dates),
TREATAS(VALUES(HDates[Year]),Dates[Year])
)
And this is the final result.
I hope it works for someone or the idea can be improved.

When to use calculated field vs measure in Power BI?

Power BI allows to add calculated field and measure to table. Both create new column and allow me to add DAX formula.
When to use calculated field vs measure in Power BI?
The most important difference is that calculated columns are calculated once when the dataset is loaded. Their value does not change later, i.e. it is not affected by slicers for example. Measures are dynamic. They are calculated whenever necessary, thus they will respond to slicers in the report.
I would recommend to read this article - Measure vs Calculated Column: The Mysterious Question? Not!
Rule of thumb: If you want to use it in a filter or a slicer, put it in a column. Otherwise, you can create it as a measure.
Link: https://learn.microsoft.com/en-gb/learn/modules/dax-power-bi-add-measures/5-compare-calculated-columns-measures
Regarding similarities between calculated columns and measures, both are:
Calculations that you can add to your data model.
Defined by using a DAX formula.
Referenced in DAX formulas by enclosing their names within square brackets.
The areas where calculated columns and measures differ include:
Purpose - Calculated columns extend a table with a new column, while measures define how to summarize model data.
Evaluation - Calculated columns are evaluated by using row context at data refresh time, while measures are evaluated by using filter context at query time.
Storage - Calculated columns (in Import storage mode tables) store a value for each row in the table, but a measure never stores values in the model.
Visual use - Calculated columns (like any column) can be used to filter, group, or summarize (as an implicit measure), whereas measures are designed to summarize.