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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Cumulative Total by Person & Date, but EXCLUDING Sales Type

I am working on creating a commissions calculator in BI desktop.  Each sales rep has a sales goal that if they reach their commission rate will go up.  I need to create a cumulative total by sales person and date that ignores opportunity type to track progress against goal. 

 

I have a DAX formula that gives me the correct cumulative amount by person and date but does not return the correct amount when I drop Type in.  What am I missing in this code?

Cumulative Amount = 
CALCULATE(
    SUM(Opportunity[Amount]),
    FILTER(
        ALL(Opportunity[Document_Date__c]),Opportunity[Document_Date__c] <= MAX(Opportunity[Document_Date__c])),
        Opportunity[StageName] = "Closed Won"
)
NameDocument_Date__cOpportunity Type Amount  Cumulative Amount SHOULD BE
Bob1/2/2019 0:00New   13,700.00                          13,700.00      13,700.00
Bob1/2/2019 0:00Renewal     4,500.00                            4,500.00        4,500.00
Bob1/7/2019 0:00New   43,680.00                          57,380.00      61,880.00
Bob1/17/2019 0:00New     7,000.00                          64,380.00      68,880.00
Bob1/22/2019 0:00New   14,100.00                          78,480.00      82,980.00
Amanda1/8/2019 0:00Renewal   13,350.00                          13,350.00      13,350.00
Mark1/2/2019 0:00New   63,524.00                          63,524.00      63,524.00
Mark1/11/2019 0:00Renewal     8,800.00                            8,800.00      72,324.00
Lindsay1/4/2019 0:00New   32,074.00                          32,074.01      32,074.00
Lindsay1/11/2019 0:00New                  -                            32,074.01      32,074.00
Mike1/4/2019 0:00Upsell         100.00                                100.00            100.00
4 REPLIES 4
v-cherch-msft
Employee
Employee

Hi @Anonymous

 

You may try below measure. If it is not your case,please share your sample data which could reproduce your scenario for us to test.You can also upload the .pbix file to OneDrive and post the link here. Do mask sensitive data before uploading.

Cumulative Amount =
CALCULATE (
    SUM ( Opportunity[Amount] ),
    FILTER (
        ALL ( Opportunity ),
        Opportunity[Document_Date__c] <= MAX ( Opportunity[Document_Date__c] )
            && Opportunity[Name] = MAX ( Opportunity[Name] )
    ),
    Opportunity[StageName] = "Closed Won"
)

Regards,

Cherie

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

Hi @Anonymous

 

Could you tell me if your problem has been solved? If it is,kindly mark the helpful answer as a solution and welcome to share your own solution. More people will benefit from here. If not, please share more details for us so that we could help further on it.

 

Regards,

Cherie

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

Probably need to replace your ALL with ALLEXCEPT(Opportunity[Document_Date__c],Opportunity[SalesPerson])


@ 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!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

I am not able to get it to work with ALLEXCEPT.  I am pullin Name and Opportunity Type from seperate tables.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

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.