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.
Hi,
How can I see if a value is in the return of function FILTERS()? e.g., I have a filter Brand(A, B, C), and I want to know if Brand A is selected to filter the data.
Or there are some other functions I can use to do it if Filters() is not a good choice,
Thanks!
Solved! Go to Solution.
Hi @Erin001,
Try measure instead of using calculated column.
FILTERS() in measure will return dynamic result, however it will always return the entire column values in a calculated column.
Thanks,
Xi Jin.
Hi @Erin001,
Yes. Brand A is selected to filter the data.
FILTERS() function returns the values that are directly applied as filters to columnName. Please refer to following simple sample:
As you can see the Source Table contains 9 rows as A to I. And the Filters table only contains 3 rows A to C. Then create a measure for Source Table with expression like:
Count Rows = COUNTROWS(FILTERS('Filters'[User]))
The result will show as 3 since the Source Table has been filtered by Filters table.
Thanks,
Xi Jin.
Thanks...and here's what I'd tried and got confused:
when I select the brand(s)(A,B, or C) from the Filter Brand, I always can see row# = CounterRows(Filters(Product[Brand]) changes with what I selected, e.g, if I select A, row# = 1; if I select A and B, Row# = 2; if I select A, B and C, row# =3.
at the same time, I created column Flag = if(ContainsRow(Filters(Product[Brand],"A"), "T","F") to test if A is selected as filter value (I tried B and C also). No matter A is seleted or not, always the Flag = "T", which means Filters(Product[Brand]) always contains all A, B and C as its values, but CounterRows() tells me another story that Filters() only contains what I select.
what I want to achieve is checking if "A" is selected and applied as filter on the dashboard. I would like to know if containsRow() or IN functions can work with FILTERS() to get things done. Or any other ADX function can do it.
Thanks!
Hi @Erin001,
Try measure instead of using calculated column.
FILTERS() in measure will return dynamic result, however it will always return the entire column values in a calculated column.
Thanks,
Xi Jin.
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 |
---|---|
114 | |
99 | |
82 | |
70 | |
61 |
User | Count |
---|---|
149 | |
114 | |
107 | |
89 | |
67 |