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

Level up your Power BI skills this month - build one visual each week and tell better stories with data! Get started

Reply
Anonymous
Not applicable

Filter companies in one table (with multiple entries)

Hey,

 

i have a table with company names in row 1, a year in row 2 and sales in row 3. The sales sum indicates the sales for that specific cutomer in that year.

 

Customer 1201810.000,- $
Customer 2201912.000,- $
Customer 1201913.000,- $
Customer 320209.000,- $

 

I want to find out, which customer had sales this year (and how much) but didnt' have any sales the last 2 years (= new customer).

 

I'm currently stuck, at the point, that i have the same customer name multiple times in the same table. so all my filter, group by attemps etc. failed.

 

Thank you for any tip 🙂

1 ACCEPTED SOLUTION
v-robertq-msft
Community Support
Community Support

Hi, @Anonymous 

According to your description, you can follow my steps:

  1. Create a calculated column:
Flag =
var _year='Table'[year]
var _company='Table'[company name]
return
if(
    (CALCULATE(
        MAX([sales ]),
        FILTER('Table',
        'Table'[year]=_year-2
        &&
        'Table'[company name]=_company))>0
    ||
    CALCULATE(
        MAX([sales ]),
        FILTER('Table',
        'Table'[year]=_year-1
        &&
        'Table'[company name]=_company))>0)
    &&
    [sales ]>0,
    0,
    1
)
  1. Create a calculated table:
New customer =
FILTER('Table',
[year]=YEAR(TODAY())
&&
'Table'[Flag]=1)

And you can get what you want, like this:

v-robertq-msft_0-1605147402398.png

 

You can download my test pbix file here

 

Best Regards,

Community Support Team _Robert Qin

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

3 REPLIES 3
v-robertq-msft
Community Support
Community Support

Hi, @Anonymous 

According to your description, you can follow my steps:

  1. Create a calculated column:
Flag =
var _year='Table'[year]
var _company='Table'[company name]
return
if(
    (CALCULATE(
        MAX([sales ]),
        FILTER('Table',
        'Table'[year]=_year-2
        &&
        'Table'[company name]=_company))>0
    ||
    CALCULATE(
        MAX([sales ]),
        FILTER('Table',
        'Table'[year]=_year-1
        &&
        'Table'[company name]=_company))>0)
    &&
    [sales ]>0,
    0,
    1
)
  1. Create a calculated table:
New customer =
FILTER('Table',
[year]=YEAR(TODAY())
&&
'Table'[Flag]=1)

And you can get what you want, like this:

v-robertq-msft_0-1605147402398.png

 

You can download my test pbix file here

 

Best Regards,

Community Support Team _Robert Qin

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Anonymous
Not applicable

Hey @v-robertq-msft ,

your solution works great! Thank you!

Now i have to learn, what you exactly did 🙂

lbendlin
Super User
Super User

Take it step by step

 

- for each customer and year find the value. 

- find the latest previous year with a value for the same customer

- if found nothing, or if the year is at least 2 years earlier than the current one, flag the entry as new customer.

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

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

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

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.