Forum Discussion

bmurf's avatar
bmurf
Frequent Visitor
4 years ago
Solved

Create Dynamic Table from Slicer

Hello All!

I'm trying to output a list of names from a dynamic slicer. 

 

I've attached Sample PBIX  file with 2 simple tables: "students" & "grades" joined by an [id] field.
I've created a slicer from a disconnected table and made a measure with a SWITCH statement to dynamically select which measure to run.  Works perfectly and CARD visual shows the dynamic results of my "_Total Students" using COUNTROWS.

The challenge is I want a table visual to dynamically display ONLY the "name" and "age" of the students selected by the slicer.  

 

 

 

Thanks for your help!

 

 

  • Hi,

    Please check the below picture and the attached pbix file.

    One of ways to create solution is, in my opinion, to create a measure like below instead of putting in the [age] column itself to the visualization.

     

     

     

    Age measure: = 
    IF (
        HASONEVALUE ( students[name] ),
        MAXX (
            FILTER ( grades, [_Total Students] <> BLANK () ),
            RELATED ( students[age] )
        )
    )

3 Replies

  • Hi,

    Please check the below picture and the attached pbix file.

    One of ways to create solution is, in my opinion, to create a measure like below instead of putting in the [age] column itself to the visualization.

     

     

     

    Age measure: = 
    IF (
        HASONEVALUE ( students[name] ),
        MAXX (
            FILTER ( grades, [_Total Students] <> BLANK () ),
            RELATED ( students[age] )
        )
    )
  • bmurf's avatar
    bmurf
    Frequent Visitor

    Awesome!  Thanks!
    One more question. I actually only wanted the [name] not the [age] so i modifed the new measure

    show names = 
    IF (
        HASONEVALUE ( students[name] ),
        MAXX (
            FILTER ( grades, [_Total Students] <> BLANK () ),
            RELATED ( students[name] )
        )
    )



      my solution was to make the table visual with:
    - 1 column 'students[name] &
    - a filter on the visual: [show names] is not blank. 

    That works fine, but is there a way to have the only column in  the table visual be the [show names] measure? 
    MAXX only shows 1 name and I couldn't quite get the code right using VALUES.  

    • Jihwan_Kim's avatar
      Jihwan_Kim
      Super User

      Hi,

      Thank you for your feedback.

      Please check the below picture and the attached pbix file.

      One of ways to achieve this is using "Filters on this visual" feature in Filters section.

       

      - Select a visualization that shows all names.

      - Go to Filters section and drag the measure (Age measure:) into the Fiters on this visual area.

      - select "is not blank" from the dropdown.

      - click Apply filter.