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

We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now

Reply
marpisa
Regular Visitor

Customers whitout current filtered year orders

Hi, I have a table containing  Customers names and Year of last order

 

Customer Name  | Year
Customer 1           2018
Customer 1           2019
Customer2            2018
Customer 2           2019
Customer 3           2018

I Have a filter slicer with years in my Report.

Now I want shows only customes whitout slicer Year orders.

So, if the filter show 

2019

my result will be only

Customer 3

Otherwhise the filter shows

2018

The list will be empty

 

In Sql my query will be:

SELECT Customer 
FROM Table
WHERE Year <> 2019

How I build the measure in PowerBi?

Thanks

MArco

1 ACCEPTED SOLUTION
v-piga-msft
Resident Rockstar
Resident Rockstar

Hi @marpisa ,

To get your desired output in Power BI, please follow the steps below.

1. Create the calculated table with the formula below.

 

slicer = VALUES(Table2[Year])

2. Create the measure like this.

 

Measure = 
VAR curr =
    SELECTEDVALUE ( Table2[Customer Name] )
VAR _string =
    CONCATENATEX (
        FILTER ( ALLSELECTED ( Table2 ), Table2[Year] = SELECTEDVALUE ( slicer[Year] ) ),
        Table2[Customer Name],
        ","
    )
VAR searchvalue =
    COUNTROWS (
        FILTER (
            ALLSELECTED ( Table2[Customer Name] ),
            SEARCH ( curr, _string, 1, -1 ) > 0
        )
    )
RETURN
    IF ( searchvalue > 0, 0, 1 )

3. Drag this measure in visual level filter and set like below.

Capture.PNG

Then you could create the year slicer based on the year column in the calculated table.

More details, please refer to my attached pbix file.

Hope this can help you!Smiley Happy

Best  Regards,

Cherry

 

Community Support Team _ Cherry Gao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

1 REPLY 1
v-piga-msft
Resident Rockstar
Resident Rockstar

Hi @marpisa ,

To get your desired output in Power BI, please follow the steps below.

1. Create the calculated table with the formula below.

 

slicer = VALUES(Table2[Year])

2. Create the measure like this.

 

Measure = 
VAR curr =
    SELECTEDVALUE ( Table2[Customer Name] )
VAR _string =
    CONCATENATEX (
        FILTER ( ALLSELECTED ( Table2 ), Table2[Year] = SELECTEDVALUE ( slicer[Year] ) ),
        Table2[Customer Name],
        ","
    )
VAR searchvalue =
    COUNTROWS (
        FILTER (
            ALLSELECTED ( Table2[Customer Name] ),
            SEARCH ( curr, _string, 1, -1 ) > 0
        )
    )
RETURN
    IF ( searchvalue > 0, 0, 1 )

3. Drag this measure in visual level filter and set like below.

Capture.PNG

Then you could create the year slicer based on the year column in the calculated table.

More details, please refer to my attached pbix file.

Hope this can help you!Smiley Happy

Best  Regards,

Cherry

 

Community Support Team _ Cherry Gao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.