DAX – Concatenating Values only when values are selected
What I am doing with the DAX below is to only show the concatenation of values if a value is filtered. If nothing is filtered (Selected) then display text to show that nothing has been selected, otherwise display in a concatenation what has been selected.
NOTE: If you individually have to select each item, it is still being filtered so it will show all the values concatenated.
Selected User =
VAR ConCat =
VALUES ( 'Power BI Audit Log'[User] ),
'Power BI Audit Log'[User],
VAR IsItFiltered =
IF ( ISFILTERED ( 'Power BI Audit Log'[User] ), ConCat, "No Users Selected" )
- What is happening above with the Variable called “ConCat” is where I am concatenating the items from the ‘PowerBI Audit Log’ table and using the [User] column.
Then in the next Variable called “IsItFiltered” I am using the IF and ISFILTERED DAX function to evaluate if the [User] column is being filtered.
- If it is being filtered then return the previous Variable called “ConCat” otherwise return “No Users Selected”
- And the final piece is where I am returning the output from the IsItFiltered Variable
This is what it looks like when No users are selected
And then when two users are selected
As always if there are any questions please leave them in the comments below.