Get certified in Microsoft Fabric—for free! For a limited time, the Microsoft Fabric Community team will be offering free DP-600 exam vouchers. Prepare now
Hi everyone,
I have a table with several columns, but 3 are important, let's name them "A", "B" and "C". I have several metrics related to these columns in this table but what matters to me is that "A", "B" and "C" all contain either yes or no, I would like to include on my report a segment that allows filtering by Yes or No for these 3 columns individually, how do I do this? Currently, if I drop these 3 columns into a segment, I only have Yes or No as a drop-down list.
In short, I'd like to have "A", "B", "C" in the same segment and be able to drop down "Yes" or "No" as a filter for each.
Thanks a lot!
Hi,
You will have to use the "Unpivot Other Columns" feature in Power Query to tranform those 3 columns into a single one.
Hi @Ouhla ,
Thanks to @amitchandak for the solution.
Based on your description, the functionality you are trying to achieve is similar to what Field Parameter is trying to demonstrate.
Here some steps that I want to share, you can check them if they suitable for your requirement.
Here is my test data:
Create filed parameter
If you only use the filed parameter, you can manipulate the visual object to control which fields are displayed.
If you want to implement a dropdown box, first you need to create a new column Y/N in the Parameter table
Then put the new column into the slicer you just created.
Create a measure
Measure = SELECTEDVALUE(Parameter[Y/N])
Apply to the table filter
Final output
Best regards,
Albert He
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
@Ouhla , Not very clear. But create a table with a one column having two values "Yes" and "No"
Now use that in slicer
now you can have measures like
countrows(filter( Table, Table[A] = selectedvalue(YN[YN]) && Table[B] = selectedvalue(YN[YN]) && Table[C] = selectedvalue(YN[YN]) ) )
You can use OR in place of and
Hello, sorry if my question was unclear. To sum up, I have a table who look like this :
Test_Table =
SELECTCOLUMNS(
ADDCOLUMNS(
GENERATESERIES(1, 5),
"A", IF(RAND() > 0.5, "Yes", "No"),
"B", IF(RAND() > 0.5, "Yes", "No"),
"C", IF(RAND() > 0.5, "Yes", "No"),
"Metrics1", ROUND(RAND() * 100, 0),
"Metrics2", ROUND(RAND() * 100, 0)),
"A", [A],
"B", [B],
"C", [C],
"Metrics1", [Metrics1],
"Metrics2", [Metrics2]
)
A | B | C | Metrics1 | Metrics2 |
Yes | Yes | Yes | 6 | 55 |
No | No | Yes | 27 | 4 |
No | Yes | Yes | 65 | 5 |
No | No | Yes | 64 | 78 |
Yes | Yes | Yes | 4 | 28 |
My goal is to create a filter so that we can filter on a visual of this table the rows that are Yes or No for columns "A", "B", "C".
I didn't know the field parameter function, so I created a filter parameter table with the 3 columns A, B, C with this code :
Parameter = {
("A", NAMEOF('Test_Table'[A]), 0, "Yes"),
("B", NAMEOF('Test_Table'[B]), 1, "Yes"),
("C", NAMEOF('Test_Table'[C]), 2, "Yes"),
("A", NAMEOF('Test_Table'[A]), 0, "No"),
("B", NAMEOF('Test_Table'[B]), 1, "No"),
("C", NAMEOF('Test_Table'[C]), 2, "No")
}
I'm super happy because with this, the filter look the way I want, but now I'm struggling to connect that with my Test_Table, even with your code, do I need to create a measure like this ?
Measure = FILTER('Test_Table', 'Test_Table'[A] = SELECTEDVALUE('Parameter'[Value4]) || 'Test_Table'[B] = SELECTEDVALUE('Parameter'[Value4]) || 'Test_Table'[C] = SELECTEDVALUE('Parameter'[Value4]) = SELECTEDVALUE('Paramètre'[Value4]))
?
Sorry again if my question wasn't clear from the start, and sorry I didn't provide a code to enable reproduction, thanks for the answers which actually helped me move forward I'm super happy about it !
Check out the October 2024 Power BI update to learn about new features.
Learn from experts, get hands-on experience, and win awesome prizes.
User | Count |
---|---|
114 | |
96 | |
90 | |
79 | |
67 |
User | Count |
---|---|
150 | |
118 | |
111 | |
106 | |
95 |