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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Ry5
Helper I
Helper I

Show First 3 selected values then a count

Hi, 
 I have a slicer and am using a card on which I want to show the first 3 selections, then a count of how many additional selections have been made. 
 I can make it show the first three OR a count if more than three are selected. 
 However I can't work out how to make it always show the first 3 no matter how many are selected.

Below is where I've got to, the _Top3 variable isn't working. The other two are fine.
Thank you!

VAR _Count = COUNTROWS( VALUES ('Table'[SlicerColum]) )
VAR _Concat = CONCATENATEX( VALUES('Table'[SlicerColumn]), 'Table1'[SlicerColumn], ", ")
VAR _Top3 = TOPN( 3, 'Table1', _Concat, ASC)

RETURN IF ( _Count > 3,
 _Top3 & " + " & (_Count - 3) & " more",
_Concat )

1 ACCEPTED SOLUTION

@Ry5 try this:

Top 3 Measure =
-- Rename to ItemList & [Item] to simplify code
VAR ItemList =
    SELECTCOLUMNS (
        VALUES ( 'Table'[SlicerColumn] ),
        "Item", 'Table'[SlicerColumn]
    )
VAR _Count =
    COUNTROWS ( ItemList )
VAR _Top3 =
    TOPN ( 3, ItemList, [Item], ASC )
VAR _Concat =
    CONCATENATEX ( _Top3, [Item], ", ", [Item] )
RETURN
    _Concat
        & IF ( _Count > 3, " + " & ( _Count - 3 ) & " more" )

Regards, Owen


Owen Auger
Did I answer your question? Mark my post as a solution!
Blog
Twitter
LinkedIn

View solution in original post

5 REPLIES 5
amitchandak
Super User
Super User

@Ry5 , Try a measure like

 

VAR _Count = COUNTROWS( VALUES ('Table'[SlicerColum]) )
VAR _Top3 = CONCATENATEX( TOPN( 3, allseleccted('Table'[SlicerColumn]), _Count, ASC), [SlicerColumn] )
RETURN _Top3

Hi, Thank you for the reply but this didn't work. It returns a full list of everything in the slicer. Even if I only select one option.

@Ry5 try this:

Top 3 Measure =
-- Rename to ItemList & [Item] to simplify code
VAR ItemList =
    SELECTCOLUMNS (
        VALUES ( 'Table'[SlicerColumn] ),
        "Item", 'Table'[SlicerColumn]
    )
VAR _Count =
    COUNTROWS ( ItemList )
VAR _Top3 =
    TOPN ( 3, ItemList, [Item], ASC )
VAR _Concat =
    CONCATENATEX ( _Top3, [Item], ", ", [Item] )
RETURN
    _Concat
        & IF ( _Count > 3, " + " & ( _Count - 3 ) & " more" )

Regards, Owen


Owen Auger
Did I answer your question? Mark my post as a solution!
Blog
Twitter
LinkedIn

Thank you, yes this works!

tamerj1
Super User
Super User

I'm replying here jut to follow on all answers. Thank you

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors