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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
damtran
Regular Visitor

Indicate New vs Existing Customer

Hi everyone,

I'd like to ask for help in this case:

- Table has 3 columns: Customer, Revenue, and Year

- Some customers have revenue in both 2022 and 2023 = Existing, some just have revenue in 2023 = New

Could you please advise how to create a new column with measure which can tell Existing or New based on customer name, revenue and year?

Thanks in advance.

1 ACCEPTED SOLUTION

hi @damtran 

try to replace:
 
COUNTROWS(
    FILTER(
       _table,
        TableName[Year] = _currentyear
    )
)
 
with:
 
COUNTROWS(
    CALCULATETABLE(
       SUMMARIZE(_table, TableName[ClientID])
        TableName[Year] = _currentyear
    )
)
 
other parts are similar.

View solution in original post

4 REPLIES 4
damtran
Regular Visitor

Hi @FreemanZ ,

Thank you very much for your prompt support, may I ask more if in column Customer, Customer name repeats in many rows within one year, how to modify these DAX? As now, I input same way and all tells it's Old Customer. Thanks in advanced. Here is the data example:

 

damtran_0-1675935118469.png

 

hi @damtran 

try to replace:
 
COUNTROWS(
    FILTER(
       _table,
        TableName[Year] = _currentyear
    )
)
 
with:
 
COUNTROWS(
    CALCULATETABLE(
       SUMMARIZE(_table, TableName[ClientID])
        TableName[Year] = _currentyear
    )
)
 
other parts are similar.

Thank you so much @FreemanZ , you help me save a lot of time!!!!!!!!!!

FreemanZ
Super User
Super User

hi @damtran 

This is almost identical to another post yesterday. please refer to my reply in this post:

https://community.powerbi.com/t5/Desktop/Determine-if-the-value-occurs-more-than-once-in-the-column/...

 

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.

Top Solution Authors