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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
PowerBI87
Frequent Visitor

Check if record exists

Hi All,

 

I was wondering if anyone had a solution for identifying new companies that have been added to my report?

 

For example, i would like a script to check the "Comapny" column to see if any exisitng record exists, then output either renewal or new in the furthest right column(new if no record exists) Then if a new opp comes into the table with the same company, change the output to renewal.

 

 

CompanyOppYearRenewal or New
XXY2017Renewal
XAB2018Renewal
XCD2019Renewal
YEF2019New

 

Any help would be greatl

 

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

Hi @PowerBI87

If there is one field  that can identify new records (such as the date field in the below screen shot) in your table, it may be easier to obtain which companies are new or renewed. Just create a calculated column with the following formula:

Renewal or New = 
VAR _countofC =
    CALCULATE (
        COUNT ( Company[Company] ),
        FILTER (
            ALL ( 'Company' ),
            'Company'[Company] = EARLIER ( 'Company'[Company] )
        )
    )
RETURN
    IF ( 'Company'[Date] = TODAY () && _countofC = 1, "New", "Renewal" )

renew or new.PNG

Best Regards

Rena

 

 

 

Community Support Team _ Rena
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

2 REPLIES 2
v-yiruan-msft
Community Support
Community Support

Hi @PowerBI87

If there is one field  that can identify new records (such as the date field in the below screen shot) in your table, it may be easier to obtain which companies are new or renewed. Just create a calculated column with the following formula:

Renewal or New = 
VAR _countofC =
    CALCULATE (
        COUNT ( Company[Company] ),
        FILTER (
            ALL ( 'Company' ),
            'Company'[Company] = EARLIER ( 'Company'[Company] )
        )
    )
RETURN
    IF ( 'Company'[Date] = TODAY () && _countofC = 1, "New", "Renewal" )

renew or new.PNG

Best Regards

Rena

 

 

 

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

Saving state is not a strong suit of Power BI. You could load the "company" table twice and turn off refresh for one of them. Then you could compare.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

AugPowerBI_Carousel

Power BI Monthly Update - August 2024

Check out the August 2024 Power BI update to learn about new features.

August Carousel

Fabric Community Update - August 2024

Find out what's new and trending in the Fabric Community.