Using DAX in PowerBI, how can I build a dynamic table that lists the values selected in a two slicers?

Problem:

I have two slicers, SlicerA and SlicerB. These are multi-select slicers.

I am trying to create a dynamic table that shows the values selected in the two slicers.

  • For ROW 1, it displays the FIRST selected option in both slicers (if any).
  • For ROW 2, it displays the SECOND option selected (if any).

For example, if the following options were selected:

  • SlicerA = Option A, Option C, Option D
  • SlicerB = Option E

I would like to see this table result as a result:

SlicerA SlicerB
OptionA OptionE
OptionC
OptionD

SelectedValues = VAR SelectedItems = VALUES('TableName'[ColumnName]) RETURN SelectedItems

I understand that I can store the selected VALUES in a variable but cannot work out how to create a UNION of results into a single table with each row in sequential order (by selection).

Any help would be appreciated and thank you for spending your time on my problem.

Thanking you in advance.

>Solution :

You’re retrieving selected values from a slicer and so you need to use a measure. Measures return scalar values and not tables and so you can’t output a table in the form you desire.

The best you can do to simulate the desired behaviour is write two measures as follows:

Measure = CONCATENATEX( VALUES('Table'[Column1]), 'Table'[Column1], UNICHAR(10))

This will still be a scalar but when placed in a table will appear over multiple rows.

Leave a Reply