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
Anonymous
Not applicable

Cumulative Total for the year

Hello All, 

 

I need an assistance with cumulative total since I ve tried many times but it is not working. Attached the matrix:

 

 

Pedro_Okazaki_0-1625603144746.png

 

 

 

This table contains the running total gross profit for a salesrep. The cumulative total I need is the Cumulative of NEW GP(USD)

 

For information ,

 

the new GP(USD) is equal to growth Year To Date minus Growth Previous Year to Date

 

The Growth Year to Date is equal to the sum of all net revenue gained by the salesrep. (calculate(sum(Sales_Data[Net Revenue]),(Sales_Data[Salesrep] = the name of the salesrep in question).

 

The previous year growth is the above formula but with the sameperiodlastyear.

 

I have a calendar table called Transaction Date Calendar and is related to the transaction date in my Sales Table.

 

The formula I am using is 

CALCULATE([New GP (USD)],FILTER(ALL(Sales_Data),Sales_Data[Transaction Date]<=MAX('Transaction Date Calendar'[Date]) && MAX(Sales_Data[TransactionYear])))
 
Would anybody know the correct way to calculate it?

 

 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Anonymous , Datesytd should help you , with help from the date table joined with Transaction Date

 

YTD Sales = CALCULATE([New GP (USD)],DATESYTD('Date'[Date],"12/31"))

 

or

 

CALCULATE([New GP (USD)],FILTER(ALL(Sales_Data),Sales_Data[Transaction Date]<=MAX('Sales_Data'[Date]) && Sales_Data[TransactionYear] = MAX(Sales_Data[TransactionYear])))

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@Anonymous , Datesytd should help you , with help from the date table joined with Transaction Date

 

YTD Sales = CALCULATE([New GP (USD)],DATESYTD('Date'[Date],"12/31"))

 

or

 

CALCULATE([New GP (USD)],FILTER(ALL(Sales_Data),Sales_Data[Transaction Date]<=MAX('Sales_Data'[Date]) && Sales_Data[TransactionYear] = MAX(Sales_Data[TransactionYear])))

Anonymous
Not applicable

@amitchandak ,

 

Both worked perfectly, thank you ver much sir.

 

Just a question, if you could answer me it would be helpful:

 

CALCULATE([New GP (USD)],FILTER(ALL(Sales_Data),Sales_Data[Transaction Date]<=MAX('Sales_Data'[Date]) && Sales_Data[TransactionYear] = MAX(Sales_Data[TransactionYear])))

 

Why should I use here Sales Data[Transaction date] instead of Transaction Date Calendar'[Date]?

 

Thank you again,

 

 

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.

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

Sept NL Carousel

Fabric Community Update - September 2024

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