Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
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. )
2. Create the relationship between two tables using field "Group" in Groups table and "Name" field in 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]))
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. )
2. Create the relationship between two tables using field "Group" in Groups table and "Name" field in 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]))
Best Regards
Rena
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
113 | |
100 | |
78 | |
76 | |
52 |
User | Count |
---|---|
144 | |
109 | |
108 | |
88 | |
61 |