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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
DianaSh
Frequent Visitor

New logo (customers) count

Hi All,

 

I'm new to Power BI and I'm trying to solve the following problem: new customers are the ones that placed a new opportunity and haven't had any opportunities >0 in 3 prior years. I created a new 'Calendar for New Logo' table that has all the dates and I have  'Opportunity for new logo' table with all customers' opportunities.

So I calculated 3 measures:

1) Running Total = VAR MaxVisibleDate =

MAX ('Calendar for New Logo'[Date])-1

VAR Previous3YearDate = EDATE(MaxVisibleDate,-36)

VAR RESULT = CALCULATE(SUM('Opportunity for new logo'[Amount_USD for Closed and Commit]), DATESBETWEEN('Calendar for New Logo'[Date],Previous3YearDate, MaxVisibleDate))

RETURN RESULT

 

2) Opp_sum = VAR CurrentDate =

MAX('Calendar for New Logo'[Date])

VAR OppAmount =

CALCULATE (SUM ('Opportunity for new logo'[Amount_USD for Closed and Commit]), FILTER(ALL('Calendar for New Logo'), 'Calendar for New Logo'[Date] = CurrentDate))

RETURN OppAmount 

 

3) 

NewLogo =

IF(('Opportunity for new logo'[Opp_sum] > 0) && ('Opportunity for new logo'[Running Total]=0),1,0)

 

I see that the issue is somewhere with Opp_sum (I don't get numbers where there're supposed to be ones), and also in NewLogo I don't get total sum of all the "1"'s.

Please help me to understand how to correct my DAX.

 

Thanks in advance

7 REPLIES 7
lbendlin
Super User
Super User

This is a standard "penultimate entry"  pattern.

 

Please provide sanitized sample data that fully covers your issue. I cannot help you without usable sample data.
Please paste the data into a table in your post or use one of the file services like OneDrive or Google Drive. I cannot use screenshots of your source data.
Please show the expected outcome based on the sample data you provided. Screenshots of the expected outcome are ok.

https://community.powerbi.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523

I have 2 connected table that I use:

Opportunity for New Logo:

CloseDateOpp_Account_Name__cQ-YearAmount_USD for Closed and Commit
Friday, September 30, 2022CompanyQ3-20220
Thursday, May 28, 2020Customer1Q2-20202800
Friday, May 29, 2020Customer1Q2-202034875
Tuesday, June 30, 2020Customer2Q2-202036549
Tuesday, July 21, 2020Customer2Q3-20202746

 

Calendar for New Logo:

Date
1/2/2018 0:00
1/3/2018 0:00
1/4/2018 0:00
1/5/2018 0:00
1/6/2018 0:00
1/7/2018 0:00
1/8/2018 0:00
1/9/2018 0:00
1/10/2018 0:00

 They are connected CloseDate <-> Date

You may not want to use connected tables for this scenario.  Your Calendar table looks incomplete - it needs to be on day level granularity and would need to extend to the current year.

 

Please provide sanitized sample data that fully covers your issue.
Please show the expected outcome based on the sample data you provided.

Hi,

My Calendar covers all the period the issue. I added it so it includes each date in the period that I need. What can be incorrect here? 

I put sample data above, each row simply shows an opportunity with customer name, date and amount ($).

The problem is in code below. I expect it to calculate the sum of all the opportunities' amount per each date. Afterwards I visualize it in the table that shows sum of opportunities' amounts per each date per each customer.

 

Opp_sum =
VAR CurrentDate =
    MAX ( 'Calendar for New Logo'[Date] )
RETURN
    CALCULATE (
        SUM ( 'Opportunity for new logo'[Amount_USD for Closed and Commit] ),
        FILTER (
            ALL ( 'Calendar for New Logo' ),
            'Calendar for New Logo'[Date] = CurrentDate
        )
    )

 

None of the close dates in your sample data is covered by your sample calendar.  Can't help you without better sample data.

Date
6/2/2020 0:00
6/1/2020 0:00
5/31/2020 0:00
5/30/2020 0:00
5/29/2020 0:00
5/28/2020 0:00
5/27/2020 0:00
5/26/2020 0:00
5/25/2020 0:00
5/24/2020 0:00
5/23/2020 0:00
5/22/2020 0:00

CloseDateOpp_Account_Name__cAmount_USD for Closed and Commit
Friday, May 29, 2020Customer 1 1770
Friday, May 29, 2020Customer 113200
Friday, May 29, 2020Customer 24330.7
Friday, May 29, 2020Customer 24.9
Friday, May 28, 2020Customer 1159.6
Friday, May 28, 2020Customer 113200

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

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