I have a data set on sales with a column named "Processes". This column has four entries: "Budget", "Forecast 1", "Forecast 2" and "Realized".
I have then inserted a slicer on this column, and I would like to always have "Realized" selected and then removed from the filter such that the end user
only can filter on "Budget", "Forecast 1" and "Forecast 2"
can't deselect "Realized".
Is this possible?
There is no direct option for your purpose. But you can achieve the requirement with some workaround as stated below-
Step-1: Create a new Disconnected (not related to any table) table new_slicer_table_name contains only three value "Budget", "Forecast 1" and "Forecast 2".
Step-2: Create a slicer using Processes column from that new table. You will have 3 values in the slicer list now.
Step-3: Put a note below the slicer like "*Realized Default Selected"
Step-4: Now create a measure as below-
show_hide =
var current_row_process = MIN(your_data_table_name[Processes])
return
IF(
current_row_process IN ALLSELECTED(new_slicer_table_name[Processes])
|| current_row_process = "Realized",
1,
0
)
Step-5: Add a visual level filter for the last created measure show_hide and show values only when show_hide = 1
This will now give you your expected output.
Related
I have 2 dropdowns called MENU 1 and MENU 2 , both created using column pagename
Now i have to create a matrix where MENU1 and MENU2 should be columns and count of visits, count of visitors, count of downloads should be values.
The challenge here is if i select some value in dropdown MENU1 and dropdown MENU2, then same should reflect in matrix column and count of visits, count of visitors, count of downloads should be updated accordingly based on my dropdown values selection
I have tried creating measure using selectedvalue function for the value selected in slicer but cannot use measure in mateix column
I have two tables, once for slicer and other one is for details table. The details table have a InvoiceDate column where some rows have blank InvoiceDate. The slicer table looks like below:
The slicer will only show value of of ID 1, like below.
Initially I want slicer to be un checked and the data should show only rows where InvoiceDate is Blank. Once User select the Slicer as Include Invoiced Records, it should show both full details i.e. Rows with Blank + Non-Empty dates rows.
There are two other ways of doing what you want that are probably more 'correct' but I'll also describe a way to provide the behavior you describe.
Option one: Delete your second table. Add a calculated column to your details table as follows:
Invoice Status = IF (ISBLANK([Invoice Date]) = TRUE(), "Not yet invoiced", "Invoiced")
Create a slicer using [Invoice Status] and simply default it to show 'not invoiced.' If users want to see the invoiced records, they just check that box in the slicer as well.
Option Two: Use Bookmarks and buttons to produce the desired effect. Create two buttons, one that says 'Include Invoiced Customers' and another that says 'Hide Invoiced Customers' -- create two bookmarks where one has the invoiced customers filtered out of the visual and one where the invoiced customers aren't filtered. Set each button's "Action" to the appropriate bookmark.
Option Three Keep your 'slicer' table. Let's assume it's called 'Invoice Filter Selection.' Create a new measure:
IncludeDetailFilter =
IF (ISFILTERED('Invoice Filter Selection'[Value]) = True(),
1,
IF (ISBLANK(MAX(InvoiceDetails[Invoice Date])) = TRUE(), 1, 0)
)
When the slicer has a selection, it will be considered 'Filtered' and you will pass into the first branch of the IF where the measure always evaluates to 1. When the slicer isn't selected, the measure will evaluate to 1 or 0 depending on whether or not there are any values for Invoice Date in the row. Add this new measure as a filter on your invoice detail visual.
Unchecked:
Checked:
Hope it Helps.
I am learning power BI , for one of my requirement i want to filter table based on the selected value from the slicer and show it in different slicer.
So, here there are 4 slicer and based on selection of one slicer i have to populate the data for the 2nd.
My Table Looks Like
id Name ParentId
1 A null
2 A.1 1
3 A.1.B.1 2
So, i have only 1 table where i have to search the element by id -> parentId and then populate it in the next slicer.
e.g: if We select A then in the next slicer we should show A.1 since , id --> 1(A) = ParentId --> 1(A.1)
I tried to create separate table and then link the id with parentid in the mapping section , this concept is working but not the problem is .
If we select A then in 2nd combo A.1 and A.2 is displaying , but as we click on A.1 on the 2nd combo and then try to click on the elements on 1st combo here in our case A , then the filter is not working properly .
If appending the elements from previous selection + New selection
e.g:
Slicer 1 Slicer 2
A -- (1,2,3)
B -- (4,5,6)
Now , after clicking on A[1st Slicer] it shows (1,2,3) [2nd Slicer]
After clicking on 2 [2nd Slicer] --> showing some elements in [3rd
slicer]
But, now again click on B [1st slicer] --> [4,5,6,2] (Wrong value)
since we selected 2 its appending with the new selection only if we
click on the 2nd slicer.
So, as an alternate solution I tried to filter the selected value which is measure from the table and then show it in the list.
My expression:
Table = FILTER(TableA, TableA[id] == Tableb[selectedId] )
Tableb[selectedId] --> is measure
Table = FILTER(TableA, TableA[id] == "8DE04141-E5B6-49E1-814A-ADB4C6FF5DCF" ) --> selected Id
1st statement is not showing any value but the 2nd giving me the result when i am hard coding value , please suggest me what i can do here.
i want to filter table based on the selected value from the slicer and show it in different slicer.
You don't need DAX for that. You just set up the correct relationships and set filters and slicers in the report.
The interaction between two slicers in Power BI gives me output with AND condition.
Example: If I selected the year 2020 and company ABC, the output would be all the data from company ABC in the year 2020.
But I want the two slicers to work with OR condition.
I have used this Dax
Include = (MAX(Table1[Column1]) = SELECTEDVALUE(Col1[Column1])) +
(MAX(Table1[Column2]) = SELECTEDVALUE(Col2[Column2]))
But the problem with above Dax I have not selected anything in slicer ( ALL by default) it is showing me a blank visual. What am I doing wrong?
let me guess you have a table "or_slicer_main_table" with Year, Company and some other columns. Now create 2 new table where the first one will contain the distinct list of Year from table "or_slicer_main_table" and the second one will contain distinct Company list from that same table.
New custom Table 1:
or_slicer_year_list =
SELECTCOLUMNS(
'or_slicer_main_table',
"YEAR", 'or_slicer_main_table'[year]
)
New custom Table 2:
or_slicer_company_list =
SELECTCOLUMNS(
'or_slicer_main_table',
"company", 'or_slicer_main_table'[company]
)
Do not establish any relation between those 3 tables.
Step-1: Create Year slicer using the newly created "or_slicer_year_list" table.
Step-2: Create Company slicer using the newly created "or_slicer_company_list" table.
Step-3: Create these following 5 measures in your table "or_slicer_main_table"
1.
year_current_row = max('or_slicer_main_table'[year])
2.
year_selected_in_slicer = SELECTEDVALUE(or_slicer_year_list[YEAR])
3.
company_current_row = max('or_slicer_main_table'[company])
4.
company_selected_in_slicer = SELECTEDVALUE(or_slicer_company_list[company])
5.
show_hide =
if(
[year_selected_in_slicer] = [year_current_row]
|| [company_selected_in_slicer] = [company_current_row],
1,
0
)
Now you have all instruments ready for play. Create your visual using columns from the table "or_slicer_main_table"
Final Step: Now just add a visual level filter for the measure "show_hide" and set value will show only when "show_hide = 1".
The final output will be something like below image-
Can you try using "IN VALUES" instead of "SELECTEDVALUE"
So your DAX should be
Include = (MAX(Table1[Column1]) IN VALUES (Col1[Column1])) +
(MAX(Table1[Column2]) IN VALUES (Col2[Column2]))
SELECTEDVALUE function returns the result only if single value is selected in slicer in case of multiple selection it will return Blank(). Thats in the case when nothing is selected (which is similar to all selected) has multiple values in set and so SELECTEDVALUE fucntion will return Blank(). This can be handled by using "IN VALUES" function which can return a set of all selected values.
I have a table visual with a date column and I have a requirement to highlight the top 2 rows. The data on the table visual is sorted desc by the date column.
I need help to conditional format the background color for the top 2 rows.
I tried searching for a way to do this but no luck.
You can calculate the rank of the rows and use conditional formatting to highlight the top 2 rows. But first, we need to define what "top 2 rows" means. You said it is sorted by date descending, so I will assume that "top 2 rows" means the rows with the 2 biggest dates. I will use a measure, which will respond to filters applied on the data. Then we will highlight the rows with rank 1 and 2 (assuming dates are unique in table's rows).
Make new measure like this:
Measure = RANKX(ALLSELECTED('Table'); CALCULATE(SELECTEDVALUE('Table'[Date])))
Where Table is your table name, and Date is the name of the date column. This will give you a number (1, 2, 3...) where 1 is the row with the biggest date, 2 is the second biggest date, and so on.
Then for every field shown in your table, add the following background color condition (right click each item in the list of fields and select Conditional formatting -> Background color):
Set Format by to be Rules, select your measure in Based on field and ad condition > 0 and <= 2 to set the desired background color. Repeat this for all fields shown.