Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a $100 discount. Register Now

Reply
naveedsaeed1
New Member

DAX command with condition

Hello community team,

 

I am using below ConcatenateX formula for the purpose to join multiple values in pivot if there is any dual values for the same variable.

=CONCATENATEX(DISTINCT(Table1[Mode]), Table1[Mode] ,", ")

 

Although there is one limitation is that whenever there is no second value or blank value so it still return a comma and a space. For Example: "ModeValue, " and sometimes if initial value is blank then it returns ", ModeValue"

I would like if there is no second value/ blank value or initial value is blank so I want the individual value to be returned without comma and the space. For Example: "ModeValue"

 

 

Thanks in advance 

2 REPLIES 2
naveedsaeed1
New Member

Dear John, Thanks for the input.

 

when i apply the same formula, there is a bit of change in the output as below. If you notice so, the values on the left are correct although when I add your formula in Excel, the output is uniform for all months (mentioned as TestFormula).

 

Thanks 


Test.png

johnt75
Super User
Super User

You could use

My Measure =
CONCATENATEX (
    DISTINCT (
        FILTER ( ALLSELECTED ( Table1[Mode] ), NOT ISBLANK ( Table1[Mode] ) )
    ),
    Table1[Mode],
    ", "
)

Helpful resources

Announcements
Fabric Community Conference

Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

February 2024 Update Carousel

Power BI Monthly Update - February 2024

Check out the February 2024 Power BI update to learn about new features.

Fabric Career Hub

Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

Fabric Partner Community

Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.

Top Solution Authors