Forum Discussion

Lauraeire_81's avatar
Lauraeire_81
Helper I
1 year ago
Solved

Display categories in table

Hi 

I am looking to display the Countries listed depending on what food items are selected in a slicer (where multiple options can be selected).

Say 'Hot Dogs', 'Corn dogs' and 'Stew' are selected, I want a measure to say something like this:

'Corn Dogs' and 'Hot dogs' found in 'America'. Count of 2. 

'Stew' is found in Ireland. Count of 1.

 

Is there any way to search on a table like this and display the items in a similar format?

Thanks in advance,

Laura

 

See table 'CountryFood' below. 

CountriesFood
AmericaHot dogs
AmericaCorn dogs
AmericaBigmacs
Ireland Stew
Ireland Cabbage and bacon
  • Hi Lauraeire_81 Try this please 

    SelectedFoodSummary = 
    VAR SelectedFoods = VALUES('CountryFood'[Food])
    VAR Result = 
        CONCATENATEX(
            SELECTCOLUMNS(
                FILTER('CountryFood', 'CountryFood'[Food] IN SelectedFoods),
                "Summary", 
                'CountryFood'[Food] & " found in " & 'CountryFood'[Countries] & "."
            ),
            [Summary], 
            " Count of " & COUNTROWS(FILTER('CountryFood', 'CountryFood'[Food] IN SelectedFoods)) & ". ", 
            UNICHAR(10)
        )
    RETURN Result

3 Replies

  • Hi Lauraeire_81 Try this please 

    SelectedFoodSummary = 
    VAR SelectedFoods = VALUES('CountryFood'[Food])
    VAR Result = 
        CONCATENATEX(
            SELECTCOLUMNS(
                FILTER('CountryFood', 'CountryFood'[Food] IN SelectedFoods),
                "Summary", 
                'CountryFood'[Food] & " found in " & 'CountryFood'[Countries] & "."
            ),
            [Summary], 
            " Count of " & COUNTROWS(FILTER('CountryFood', 'CountryFood'[Food] IN SelectedFoods)) & ". ", 
            UNICHAR(10)
        )
    RETURN Result
  • v-echaithra's avatar
    v-echaithra
    Community Support

    Thanks Akash_Varuna  for Addressing the issue.

     

    we would like to follow up to see if the solution provided by the super user resolved your issue. Please let us know if you need any further assistance.
    If the above response resolved your issue, please mark it as "Accept as solution" and click "Yes" if you found it helpful.

     

    Regards,
    Chaithra.

  • v-echaithra's avatar
    v-echaithra
    Community Support

    Hi Lauraeire_81 

    we wanted to kindly follow up to check if the solution provided for the issue worked? or Let us know if you need any further assistance?
    If our response addressed, please mark it as Accept as solution and click Yes if you found it helpful.

    Regards,
    Chaithra.