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
HLEBOEUF
New Member

YTD Troubles

Hello.

I'm having a complete time dimension that works fine with the regular YTD, MTD .....

But I've created a 2nd date field that holds for every date the date of yesterday in that year.

Some example

10/06/2016   Holds 10/05/2016

10/03/2016   Holds 10/05/2016

10/06/2014   Holds 10/05/2014

Even if the user makes no date selections I can compare a 'honest' YTD over the years to see progress over the years.

When I look in the data this field is correct.

But as soon as I used a TOTALYTD on that field it doesn't work.

Here are my formulas ...

Year_Today = DATE(YEAR(TODAY()-1)-IF('Dim_Dates'[Dat_Date]>TODAY()-1;BLANK();DATEDIFF('Dim_Dates'[Dat_Date];TODAY()-1;YEAR));MONTH(TODAY()-1);DAY(TODAY()-1))

YToday Visitors All = TOTALYTD(SUM('Fact_Sessions'[Sess_Visitors_All]); 'Dim_Dates'[Dat_Date])  (Working)

YTDToday Visitors All = TOTALYTD(SUM('Fact_Sessions'[Sess_Visitors_All]); 'Dim_Dates'[Year_Today])   (Funny)

 

And these are the resultsCapture.PNG

 

I supose i'm abusing the idea of YTD but have no idea why ....

1 REPLY 1
v-yulgu-msft
Employee
Employee

Hi, @HLEBOEUF

 

To use the TOTALYTD function, you should know that it only works using a separate date table with continuous dates. You should create a calendar table mapping to the data table (in your scenario, I guess it's 'Fact_Sessions'). I suppose that you have linked the table 'Fact_Sessions' to calendar table based on the column 'Dim_Dates'[Dat_Date], so the formula for "YToday Visitors All" worked fine. That is why when you used " 'Dim_Dates'[Year_Today]" in TOTALYTD function it didn't work as you expected. In short, the date column we used in YTD must be a specified column which is the relationship between two linked tables.

 

If you have any question, please feel free to ask. For more advice, please share some sample data and the relationships of between the tables.

 

Best regards,
Yuliana Gu

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

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.