Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now
Dear Power BI community,
I am having a hard time setting a dynamic filter on a report.
I am trying to use a filter in order to set a measure, it is a single selection filter.
Selected = if(HASONEVALUE('Table['Name]);SELECTEDVALUE('Table[Name]);"ALL")
I am getting the selected filter through this and using switch to select a column based on the selection
SWITCH([Selected];"ALL";MAX(Table[Name1]);MAX(Table[Name2]))
I would like to use a column if nothing is selected (Table[Name1]) and the other column (Table[Name2]) for any single selection filter.
I tried as well with the following measures
Selected = COUNTROWS(FILTERS('Table['Name])) this is to get how many filters are selected in the visual
I am then setting this condition using the above measure
IF ([Selected] > 1 ; MAX(Table[Name1]) ; MAX('Table'[Name2]))
Both are always returing the same column regardless of the condition.
Appreciate your help
Solved! Go to Solution.
Hi @Farwest ,
Please try to complete the following steps to achieve your requirement:
1. Create one dimension table for name field(Group 1,Group 2,Group 3 etc. )
Create table Groups
2. Create the relationship between two tables using field "Group" in Groups table and "Name" field in Table
Create relationship between dimension and fact table
3. Create a measure and drag the related fields onto the visual as below screen shot
Measure = IF(ISFILTERED('Groups'[Group]),MAX('Table'[Name 2]),MAX('Table'[Name 1]))Create measure and table visual
Best Regards
Rena
Even i'm having a similar requirement ..
Whenver user select single value from slicer in a dynamic table then we should filter out null records but whenever use select more than 1 column then display all values in every columns (no need to filter out.) Any idea how to achieve this ?
I think measure selection you can do like -https://community.powerbi.com/t5/Desktop/Slicer-MTD-QTD-YTD-to-filter-dates-using-the-slicer/td-p/50...
For axis/column , you might have to use bookmarks as of now
https://radacad.com/bookmarks-and-buttons-making-power-bi-charts-even-more-interactive
Thanks @amitchandak
This actually works better, but I still have a problem.
This works when I define the selected Filter Value "Selected", but I am trying to:
if only one filter is selected then get 'Table' [Name 1] otherwise (all selected) get 'Table' [Name 2] (this is a single filter selection anyway)
@Farwest ,
Try like
IF(isfiltered('Table' [Name]) && HASONEFILTER('Table' [Name]);
SWITCH(SELECTEDVALUE('Table' [Name]);
"Selected"; MAXX('Table' [Name 1]);
MAXX('Table' [Name 2])
);
MAXX('Table' [Name 2])
)
Tried out as well but not really reaching the expected result.
I am adding more details to better exlain the case, the result I have today is a bit different.
When no filter is selected group 3 is still showing Name 1 table where it should be Name 2 as per the DAX on previous post.
Every time one group is filtered I would liket o get Table[Name 1]
Every time no filter is selected I would like to get Table [Name 2]
I have hundreds of groups so I don't want to enter them one by on in the SWITCH like SWITCH(SELECTEDVALUE('Table' [Name]);
"Group 1"; ...."Group 2";...
Hi @Farwest ,
Please try to complete the following steps to achieve your requirement:
1. Create one dimension table for name field(Group 1,Group 2,Group 3 etc. )
Create table Groups
2. Create the relationship between two tables using field "Group" in Groups table and "Name" field in Table
Create relationship between dimension and fact table
3. Create a measure and drag the related fields onto the visual as below screen shot
Measure = IF(ISFILTERED('Groups'[Group]),MAX('Table'[Name 2]),MAX('Table'[Name 1]))Create measure and table visual
Best Regards
Rena
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
| User | Count |
|---|---|
| 50 | |
| 34 | |
| 32 | |
| 18 | |
| 17 |
| User | Count |
|---|---|
| 64 | |
| 64 | |
| 41 | |
| 27 | |
| 24 |