Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
DynamicDax
New Member

TopN is returning less rows than selected when using 2nd slicer

Hi everyone,

 

I have two seperate slicers that aren't working together. 

 

The TopN Slicer will narrow down to the correct number selected; however, the 2nd slicer will then filter the Top N further and give me less options than desired. I.e. TopN=8, 8 rows shown properly, then when using 2nd slicer, it will filter it down further instead of maintaining the TopN of 8.

 

1) Slicer1: TopN

2)Slicer 2: Filters options based on 3 colors: Green, yellow, red

 

Dax:

Slicer1:

Index column=just a column incrementally going up by 1, from 1 to 100

RowNum =
CALCULATE (
COUNT ( RX[Index]),
FILTER ( ALLSELECTED ( RX ), RX[Index] <= MAX ( RX[Index] ) ))
StoreRankbySelectedN = IF([RowNum]<=[TopNValuesMeasure],1,0)
 
Slicer2:
Color_availability_Table = DATATABLE("Availability",INTEGER,"Color",STRING,{{0,"Green"},{1,"Yellow"},{3,"Red"}})
# trips by slicer1 =
 
 
VAR Trips = [Final Color]
Return

IF(
HASONEVALUE('Color_availability_Table'[Color]),
SWITCH(TRUE(),
VALUES(Color_availability_Table[Flag#])=0&&Trips<1, Trips,
VALUES(Color_availability_Table[Flag#])=1&&Trips>=1&&Trips<3, Trips,
VALUES(Color_availability_Table[Flag#])=3&&Trips>=3, Trips)
,Trips
)
2 REPLIES 2
v-jianboli-msft
Community Support
Community Support

Hi @DynamicDax ,

 

Based on your description, it seems that the fields involved in both slicers are in the same table?

If you don't want them to affect each other, please consider splitting this table into two separate tables, creating the slicers again to avoid them from affecting each other by reasonable modeling.

 

Best Regards,

Jianbo Li

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

I would like the 2nd slicer to work first. I think it may have to do with how the DAX was setup for both slicers. Will mirror existing TopN and find a better way to slice for the 2nd need. Thank you!

 

 

Helpful resources

Announcements
July 2024 Power BI Update

Power BI Monthly Update - July 2024

Check out the July 2024 Power BI update to learn about new features.

July Newsletter

Fabric Community Update - July 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors
Top Kudoed Authors