Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!
Hello All,
I am new to Power BI and I am struggling to achieve a filter/slicer, and here is the story:
We are using power bi desktop october 2020 since the platform we are using only allows to upload these pbx report/dashboards.
We have a table that includes the tenure of the employees on days, so I created a calculated column that label them as follows:
The problem I have is that the calculated column is somehow overwriting the labels, so for example if I choose <30 it works well, if I choose <60 will include only those from between >= 30 and <60. So the main problem is that higher selections are not including lower ones.
If I want to get all those <120 I must check <120, <90, <60, <30 together. So my question is if there is a way to include lower tenure, <60 include <30 or <90 include <60 and <30 as well. so If I finally select just the <120 option on the slicer it includes <120, <90, < 60 and <30 without having to select all of them.
Please let me know if this makes sense and if I explained myself.
Thanks in advance to all!
Hi @appnalytica ,
Has your problem been solved? If it is solved, please mark a reply which is helpful to you.
If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.
Best Regards,
Winniz
@appnalytica Create your slicer table as a separate Enter Data query. Then create a measure that returns the row given the right criteria. Like:
Measure =
VAR __Selection = MAX('Slicer'[Value])
RETURN
SWITCH(__Selection,
"<120",IF(SUM([Tenure])<120,1,0),
"<90",IF(SUM([Tenure])<90,1,0)
...
Hello!
Thanks for your really quick response I really appreciate it. I created a new table just with the values:
Then I added the slicer getting the values from that table and column and got it:
When I make a selection the circular dots appear on the corners of the visuals like it's updating but it seems it is not affecting/filtering the main table. This is the processed I followed:
1. Create new table just with the filter values <120, <90, etc.
2. Created a new slicer and used the new table column as the values for the slicer which gave me this:
3. Create the new measure on the main employee table setting up the references like this:
Measure =
VAR __Selection = MAX('Slicer'[Value]) <- This is the slicer on Main table with the values from the new table
RETURN
SWITCH(__Selection,
"<120",IF(SUM([MainTable_Tenure])<120,1,0),
"<90",IF(SUM([MainTable_Tenure])<90,1,0)
"<60",IF(SUM([MainTable_Tenure])<60,1,0)
"<30",IF(SUM([MainTable_Tenure])<30,1,0)
)
I am not sure if am missing something or what could be wrong I also checked the interactions and it seems it's applying but its not changing the other visuals, for example when I choose <30 show 1200, <60 1600 (1200 <30 + 400 <60) and so on.
Thanks again for all your help!
Hi @appnalytica ,
I create the following sample data:
Then create the measure and show items when the measure is 1.
Measure =
VAR __Selection = SELECTEDVALUE('Slicer'[Value])
RETURN
SWITCH(
__Selection,
"<120", IF( SUM(MainTable[Tenure]) < 120, 1, 0 ),
"<90", IF( SUM(MainTable[Tenure]) < 90, 1, 0 ),
"<60", IF( SUM(MainTable[Tenure]) < 60, 1, 0 ),
"<30", IF( SUM(MainTable[Tenure]) < 30, 1, 0 ),
">=120", IF( SUM(MainTable[Tenure]) >= 120, 1, 0 ),
1
)
If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.
Best Regards,
Winniz
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
User | Count |
---|---|
141 | |
113 | |
104 | |
78 | |
64 |
User | Count |
---|---|
136 | |
125 | |
107 | |
70 | |
61 |