Search code examples
powerbidaxm

How can I ouput the values of a column (values() function) as a list in DAX for Power BI?


I use Power BI to create reports and visuals for large enterprise clients.

I have an interesting request from one of my clients: they would like to be able to see a summary of all filters that are applied to a given report. I used the ISFILTERED() function to create a card visual that lists the dimensions that are filtered, but they would like to be able to see which values are being shown. This works just fine when they have sliced or filtered for just one value, but how can I show when more than one is selected? My DAX is below:

Applied Filters = 
    var myvalues = VALUES(mytable[dimension_column])
    return
        IF(ISFILTERED(mytable[dimension_column]) = FALSE(),
           "Not filtered", 
           "Column Name:" & UNICHAR(10) & mylist)

When only one value is selected in the slicer, the output is:

Column Name: 
Selected Value

Obviously, when more than one value is selected in the slicer, variable mylist will have more than one value and the function fails. My question is, how can I convert the column myvalue to a list in DAX, so I can output each and every value?

What I want to get is:

Column Name: 
Selected Value1,
Selected Value2,
etc.

Thank you!


Solution

  • One possibility is to concatenate all the values into a single string.

    For example, you'd replace mylist with the string

    CONCATENATEX(VALUES(mytable[dimension_column]), mytable[dimension_column], UNICHAR(10))
    

    You're really only returning a single value for the measure, but it looks like a column.