cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Pbi07
Helper IV
Helper IV

TOTALYTD Question - Different results

Having a question on the way TOTALYTD behaves. 

 

Trying to get a cumulative totals for the monthly total sales  and receipts from the below data

 

Pic1.JPG

I have a calendar table and relationship set and able to arrive at the cumulative totals using the TOTALYTD fn. 

 

calendar = CALENDARAUTO()

 

pic2.JPG

When i try using the similar method on a direct query data, my results gets distorted. 

The below YTD_Sales as of Jan resets to 300 instead of 400. 

YearMonthSales_TotalRecpt_TotalYTD_Sales
2017Oct100 100
2017Nov  100
2017Dec  100
2018Jan300 300
2018Feb600 900
     

 

What is causing this kind of difference? 

 

 

 
1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Pbi07 , Did you got the answers, If not please share additional information.



Power BI Features || Datamarts: https://youtu.be/8tskWsJTEpg || Field Parameters : https://youtu.be/lqF3Wa1FllE?t=70
Time Intelligence Decoded : https://youtu.be/aU2aKbnHuWs&t=145s
Did I answer your question? Mark my post as a solution! Appreciate your Kudos !! Proud to be a Super User! !!
Dashboard of My Blogs !! Connect on Linkedin !! Subscribe to my youtube Channel !!
Want To Learn Power BI | Beginners !! Advance Concepts !! Power BI For Tableau User !!

View solution in original post

4 REPLIES 4
amitchandak
Super User
Super User

@Pbi07 , Did you got the answers, If not please share additional information.



Power BI Features || Datamarts: https://youtu.be/8tskWsJTEpg || Field Parameters : https://youtu.be/lqF3Wa1FllE?t=70
Time Intelligence Decoded : https://youtu.be/aU2aKbnHuWs&t=145s
Did I answer your question? Mark my post as a solution! Appreciate your Kudos !! Proud to be a Super User! !!
Dashboard of My Blogs !! Connect on Linkedin !! Subscribe to my youtube Channel !!
Want To Learn Power BI | Beginners !! Advance Concepts !! Power BI For Tableau User !!

@v-yuta-msft  @amitchandak 

 

Thanks @amitchandak for clarifying on the YTD function. I took the below approach to solve it.

 

M_Cumulative_Total =
VAR MaxDate=CALCULATE(MAX(Calendar[Date]), Invoice)
RETURN CALCULATE([Inv_total], FILTER(ALL(Calendar[Date]), Calendar[Date]<=MaxDate))
v-yuta-msft
Community Support
Community Support

@Pbi07 ,

 

Could you please share the sample data and give the measure you are using?

 

Regards,

Jimmy Tao

amitchandak
Super User
Super User

YTD will reset at the start of year. If you are looking for cumulative

try

Cumm Sales = CALCULATE(SUM(Sales[Sales Amount]),filter(date,date[date] <=maxx(date,date[date])))

Cumm Sales = CALCULATE(SUM(Sales[Sales Amount]),filter(date,date[date] <=maxx(date,endofmonth(dateadd(date[date]),-1,month))))



Power BI Features || Datamarts: https://youtu.be/8tskWsJTEpg || Field Parameters : https://youtu.be/lqF3Wa1FllE?t=70
Time Intelligence Decoded : https://youtu.be/aU2aKbnHuWs&t=145s
Did I answer your question? Mark my post as a solution! Appreciate your Kudos !! Proud to be a Super User! !!
Dashboard of My Blogs !! Connect on Linkedin !! Subscribe to my youtube Channel !!
Want To Learn Power BI | Beginners !! Advance Concepts !! Power BI For Tableau User !!

Helpful resources

Announcements
August 2022 update 768x460.jpg

Check it Out!

Click here to learn more about the August 2022 updates!

August 1 episode 9_no_dates 768x460.jpg

The Power BI Community Show

Watch the playback when Priya Sathy and Charles Webb discuss Datamarts! Kelly also shares Power BI Community updates.

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Top Solution Authors
Top Kudoed Authors