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
Brett007
Helper III
Helper III

Filter Results without reducing the values in the column

I would like to filter results to show all locations with Product Line A and show all of the other Product Lines produced in that location.

 

Brett007_0-1613687482720.png

 

This is the bad result

Brett007_0-1613687658991.png

 

I would like to see the other Product Lines made in those locations at the same time.

 

This is the Measure that I use to generate the "List of Product Line values" column

Brett007_1-1613687754718.png

Main table of values is 'allChart'

Brett007_2-1613687864739.png

 

 

Let me know if you have any ideas.

 

Thank you,

-Brett

 

 

 

 

 

1 ACCEPTED SOLUTION
OwenAuger
Super User
Super User

Hi @Brett007 

 

The solution I would suggest involves using ALL ( 'allChart'[Product Line] ) to clear the filter on Product Line when determining the list of Product Line values

 

In the code below, ValuesComplete is a list of Product Lines with the Product Line filter cleared.

 

I also rewrote the code slightly, using the fact to TOPN will return all the values if there are fewer than N.

 

Does this work as expected?

 

List of Product Line values = 
VAR __MAX_VALUES_TO_SHOW = 100
VAR ValuesComplete =
    CALCULATETABLE (
        VALUES ( 'allChart'[Product Line] ),
        ALL ( 'allChart'[Product Line] )
    )
VAR __DISTINCT_VALUES_COUNT =
    COUNTROWS ( ValuesComplete )
VAR DisplayEtc =
    __DISTINCT_VALUES_COUNT > __MAX_VALUES_TO_SHOW
VAR Result =
    CONCATENATEX (
        -- TopN can be used even if num items is smaller than max
        TOPN (
            __MAX_VALUES_TO_SHOW,
            ValuesComplete,
            'allChart'[Product Line], ASC
        ),
        'allChart'[Product Line],
        ", ",
        'allChart'[Product Line], ASC
    )
        & IF (
            DisplayEtc,
            ", etc."
        )
RETURN
    Result

 

 


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 @Brett007 

 

The solution I would suggest involves using ALL ( 'allChart'[Product Line] ) to clear the filter on Product Line when determining the list of Product Line values

 

In the code below, ValuesComplete is a list of Product Lines with the Product Line filter cleared.

 

I also rewrote the code slightly, using the fact to TOPN will return all the values if there are fewer than N.

 

Does this work as expected?

 

List of Product Line values = 
VAR __MAX_VALUES_TO_SHOW = 100
VAR ValuesComplete =
    CALCULATETABLE (
        VALUES ( 'allChart'[Product Line] ),
        ALL ( 'allChart'[Product Line] )
    )
VAR __DISTINCT_VALUES_COUNT =
    COUNTROWS ( ValuesComplete )
VAR DisplayEtc =
    __DISTINCT_VALUES_COUNT > __MAX_VALUES_TO_SHOW
VAR Result =
    CONCATENATEX (
        -- TopN can be used even if num items is smaller than max
        TOPN (
            __MAX_VALUES_TO_SHOW,
            ValuesComplete,
            'allChart'[Product Line], ASC
        ),
        'allChart'[Product Line],
        ", ",
        'allChart'[Product Line], ASC
    )
        & IF (
            DisplayEtc,
            ", etc."
        )
RETURN
    Result

 

 


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

Works perfectly.  Thank you.

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.