Forum Discussion

milindgupta's avatar
milindgupta
Regular Visitor
2 years ago
Solved

Top N Filter not working when Slicer value is selected.

I am building a dashboard where I have created a column chart to display Top 3 values (Refer Screenshot below). The column chart correctly shows Top 3 categories on default settings. I have few slicers on the page, for eg. Gender. As soon, I select any value from these slicers (e.g. Female from Gender slicer), the Top 3 filter stops working and it shows all possible data into the chart.

 

Before Selecting Slicer value:

 

 

Filter setting:

 

 

After selecting slicer value:

 

How to make it work correctly.

 

  • milindgupta , Seem like because of same value. Also, you should prefer to use measure then column.

     

    You can use a measure with a window function, and you can break ties easily

     

    example

    M1 =Sum('Table'[value])

    TOPN using window = Sumx(KEEPFILTERS(Window(1,ABS,3,ABS, ALLSELECTED('Table'[Study Institude]]),ORDERBY([M1],Desc))),[M1] )

     

    Break ties

     

    M1 =Sum('Table'[value])

    TOPN using window = Sumx(KEEPFILTERS(Window(1,ABS,3,ABS, ALLSELECTED('Table'[Study Institude]]),ORDERBY([M1],Desc, [Study Institude], asc))),[M1] )

     

    Learn Power BI: Dynamic TOPN using TOPN/Window and Numeric parameter: https://youtu.be/vm2mdEioQPQ

1 Reply

  • milindgupta , Seem like because of same value. Also, you should prefer to use measure then column.

     

    You can use a measure with a window function, and you can break ties easily

     

    example

    M1 =Sum('Table'[value])

    TOPN using window = Sumx(KEEPFILTERS(Window(1,ABS,3,ABS, ALLSELECTED('Table'[Study Institude]]),ORDERBY([M1],Desc))),[M1] )

     

    Break ties

     

    M1 =Sum('Table'[value])

    TOPN using window = Sumx(KEEPFILTERS(Window(1,ABS,3,ABS, ALLSELECTED('Table'[Study Institude]]),ORDERBY([M1],Desc, [Study Institude], asc))),[M1] )

     

    Learn Power BI: Dynamic TOPN using TOPN/Window and Numeric parameter: https://youtu.be/vm2mdEioQPQ