Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

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.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

  • 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.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading