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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
Anonymous
Not applicable

Dynamic Title with non unique column values

Hi, 

I am trying to create a dynamic title for a report based on a multi-select filter.  The filter is a country filter using the SalesTerritory Table of the Adventure Works dataset.Sales Territory.JPG

 

 

The DAX formula I am using is:

 

Country Title = IF(ISFILTERED('Dim SalesTerritory'[FlagURL]), "Sales by Country: " & CONCATENATEX('Dim SalesTerritory','Dim SalesTerritory'[SalesTerritoryCountry], ", ") , "Sales by Country: All Countries")
 
This works fine when I select any country but the United States:

Sales by Country.JPG

 

 

The issue I am running into is that the United States is broken up into Northwest, Northeast, Central, Southeast and Southwest in this table which is causing the title to show United States 5 times as shown below:


Sales by Country USA.JPG

 

I've tried creating an additional table with the list of unique countries and creating a relationship between the SalesTerritory table and this lookup table and using the country from this table as part of the DAX above but this isn't working.

 

Any help on this would be gratefully appreciated. 

Thanks, 

Vav

1 ACCEPTED SOLUTION
OwenAuger
Super User
Super User

Hi Vav,

 

You can use a either VALUES or DISTINCT to return the distinct values of the SalesTerritoryCounty column and use that as the first argument of CONCATENATEX.

 

Try the below code (I just changed the first argument of CONCATENATEX):

 

Country Title =
IF (
    ISFILTERED ( 'Dim SalesTerritory'[FlagURL] ),
    "Sales by Country: "
        & CONCATENATEX (
            VALUES ( 'Dim SalesTerritory'[SalesTerritoryCountry] ),
            'Dim SalesTerritory'[SalesTerritoryCountry],
            ", "
        ),
    "Sales by Country: All Countries"
)

Regards,

Owen


Owen Auger
Did I answer your question? Mark my post as a solution!
Blog
Twitter
LinkedIn

View solution in original post

2 REPLIES 2
OwenAuger
Super User
Super User

Hi Vav,

 

You can use a either VALUES or DISTINCT to return the distinct values of the SalesTerritoryCounty column and use that as the first argument of CONCATENATEX.

 

Try the below code (I just changed the first argument of CONCATENATEX):

 

Country Title =
IF (
    ISFILTERED ( 'Dim SalesTerritory'[FlagURL] ),
    "Sales by Country: "
        & CONCATENATEX (
            VALUES ( 'Dim SalesTerritory'[SalesTerritoryCountry] ),
            'Dim SalesTerritory'[SalesTerritoryCountry],
            ", "
        ),
    "Sales by Country: All Countries"
)

Regards,

Owen


Owen Auger
Did I answer your question? Mark my post as a solution!
Blog
Twitter
LinkedIn
Anonymous
Not applicable

Thanks a million @OwenAuger , 

I had tried distinct earlier but it was crashing on multiselect but VALUES is exactly what I needed. Woman Happy

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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