Reputation: 31
I have a Bar Chart Visual and for its X axis values(Area, Population, Birth Rate, etc) I've created a field parameter. So the visual displays population by country name or Area by country name depending on the value selected by user. But I want to add 2 buttons namely All Countries and Top 10 countries and if the user clicks on top 10 countries and selects value as Birth Rate from field parameter, then the visual should display top 10 countries according to birth rate.
I've created the entire dashboard, but I am not able to apply topN filter. Other than the default columns in field parameter table, I've added another column where I've extracted the selected value of slicer and I am using that column in the top N field but it's not working.
Upvotes: 1
Views: 252
Reputation: 2480
pls see if this is what you want
id value category
a 100 AAA
b 200 AAA
c 300 BBB
d 400 BBB
e 500 CCC
f 600 CCC
g 700 AAA
h 800 AAA
i 900 BBB
j 1000 AAA
k 1100 AAA
l 1200 CCC
create a parameter field for id and category for testing.
only select id and top 2 then we filter top 2 id for all data.
Parameter = {
("category", NAMEOF('Table'[category]), 0),
("id", NAMEOF('Table'[id]), 1)
}
_sum = sum('Table'[value])
MEASURE =
VAR _rank =
RANKX ( ALL ( 'Table'[id] ), [_sum],, DESC )
RETURN
IF (
HASONEFILTER ( 'Table'[id] )
&& SELECTEDVALUE ( 'Table (2)'[Column1] ) = "TOP2",
IF ( _rank <= 2, 1, 0 ),
1
)
then add the measure to filter and set to 1
then we can see all and top 2 work for selection of id
when we select category, the top2 does not work
Upvotes: 0