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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
RAdams
Helper III
Helper III

HASONEFILTER to show Text

Hello everyone! I have a question regarding showing columns in a table when a slicer is selected. 

 

I have this code, which works fine when the slicer is selected.  It's showing the data from one customer as the Sales Data table has one row for each Customer and their respective sales data. I had to use Sum to get the data to show up even though there is only one row. 

 

 

 Balance = IF(
HASONEFILTER('Sales Data'[CustomerName]),
SUM(AR[balance_due]),
BLANK()
)

 

Now, I'm trying to show the Customer Name in the same table mentioned above. Here's the code I've written after a few iterations of trying to get it to work: 

 

 

Customer = IF(
HASONEFILTER('Sales Data'[CustomerName]),
CONCATENATEX(VALUES(AR[customer_name]),
BLANK()
))

 

 

But nothing seems to be working. I just want the Customer Name, Balance Due and a few other values to show up when one item is selected in the Slicer. 

 

Any help would be great! 

 

Thanks!

R

1 ACCEPTED SOLUTION
Zubair_Muhammad
Community Champion
Community Champion

Hi @RAdams

 

Concatenatex takes atleast two arguments ...first argument a table or an expression that returns a table. The second argument is a column that contains the values you want to concatenate, or an expression that returns a value.

Try this

 

Customer =
IF (
    HASONEFILTER ( 'Sales Data'[CustomerName] ),
    CONCATENATEX ( VALUES ( AR[customer_name] ), AR[customer_name] ),
    BLANK ()
)

 


Regards
Zubair

Please try my custom visuals

View solution in original post

2 REPLIES 2
Zubair_Muhammad
Community Champion
Community Champion

Hi @RAdams

 

Concatenatex takes atleast two arguments ...first argument a table or an expression that returns a table. The second argument is a column that contains the values you want to concatenate, or an expression that returns a value.

Try this

 

Customer =
IF (
    HASONEFILTER ( 'Sales Data'[CustomerName] ),
    CONCATENATEX ( VALUES ( AR[customer_name] ), AR[customer_name] ),
    BLANK ()
)

 


Regards
Zubair

Please try my custom visuals

NICE!!!

 

Everyone in the office is looking at me as I squeal like a little girl! 

 

Thanks @Zubair_Muhammad!

 

R

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors