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
CobbSalad
Regular Visitor

TotalYTD in a Matrix

Hi y'all,

 

I am having difficulty getting totalYTD to work in my matrix. I currently have sales data between 2018 to May 3rd 2021. My goal is for totalYTD to forecast for the rest of the year and then I can visually shift through the dates using a date hierarchy.

 

The DAX I am currently using is as follows:

 

Year to Date = TOTALYTD(SUM('Sales Data'[Net Sales]),'Sales Data'[Day].[Date])

 

I issue might be because all my data is in one query rather than seperate queries?

 

Any help is greatly appreciated as well as any advice for doing this a different way!

 

Thanks!

 

1 ACCEPTED SOLUTION

Hi  @CobbSalad,

 

The hierarchy should be in your original table rather than the calendar table,check my sample below:(remember to create a relationship between the 2 tables)

v-kelly-msft_0-1623650572007.pngv-kelly-msft_1-1623650582291.pngv-kelly-msft_2-1623650590374.pngv-kelly-msft_3-1623650597642.png

 

Check my .pbix file attached.

 

Best Regards,
Kelly

Did I answer your question? Mark my post as a solution!

View solution in original post

3 REPLIES 3
aj1973
Community Champion
Community Champion

Hi @CobbSalad 

I think your issue is more like using Time intelligence function without a Calendar table. if you have gaps in your 'Sales Data'[Day].[Date]  then don't count on TOTALYTD to outcome an accurate result.

 

Regards
Amine Jerbi

If I answered your question, please mark this thread as accepted
and you can follow me on
My Website, LinkedIn and Facebook

Thank you for the reply!

 

I created the calendar table, but I am still having the same issue as before where it just repeats the last sales data from May 3rd 2021. I want to be able to drill down through a date hierarchy. In the dax code what would that look like as I am unsure of how to link it to a hierarchy within the calendar table. I have the calendar hierarchy broken down between 'CalendarYear' 'CalendarQuarter' 'CalendarMonth' 'CalendarDate'.

 

The DAX I am currently using is as follows:

 

Year to Date = TOTALYTD(SUM('Sales Data'[Net Sales]),'Calendar Table'[CalendarDate])

 

Thanks again!

 

Hi  @CobbSalad,

 

The hierarchy should be in your original table rather than the calendar table,check my sample below:(remember to create a relationship between the 2 tables)

v-kelly-msft_0-1623650572007.pngv-kelly-msft_1-1623650582291.pngv-kelly-msft_2-1623650590374.pngv-kelly-msft_3-1623650597642.png

 

Check my .pbix file attached.

 

Best Regards,
Kelly

Did I answer your question? Mark my post as a solution!

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.