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

Can't get YTD DAX formula to work in power bi service

Hey,

 

I'm struggling with a measure that I have made in Power BI desktop, calculating YTD sales.

 

The measure is as follows:

 

YTD 2008 = TOTALYTD([TotalSales];DimDate[FullDateAlternateKey];"31.12.2008")

 

And it works perfectly in power BI DESKTOP. However, when importing to BI service, it "Couldn't retrieve data for this visual". Different measures that I have calculated have no problem loading.

 

Does anyone know what the problem might be?

1 ACCEPTED SOLUTION
v-huizhn-msft
Employee
Employee

Hi @oll,

If there are mutiple years data in your DimDate table. The TOTALYTD will calculate the different years' year-to-day sum.
The default year-end-date is December 31. For exemple, I have date from 2013/1/1-2015/12/31, it return the sum of 2013,2014,2015 saperately. You are not supposed to add year in year-end-date parameter, you just need to add the month/day wanted to end. 

Measure1 = TOTALYTD(SUM(Sales[SALE]),DimDate[Date])


2.PNG

It works fine when I publish it to service.

Best Regards,
Angelia

 

View solution in original post

2 REPLIES 2
v-huizhn-msft
Employee
Employee

Hi @oll,

If there are mutiple years data in your DimDate table. The TOTALYTD will calculate the different years' year-to-day sum.
The default year-end-date is December 31. For exemple, I have date from 2013/1/1-2015/12/31, it return the sum of 2013,2014,2015 saperately. You are not supposed to add year in year-end-date parameter, you just need to add the month/day wanted to end. 

Measure1 = TOTALYTD(SUM(Sales[SALE]),DimDate[Date])


2.PNG

It works fine when I publish it to service.

Best Regards,
Angelia

 

KHorseman
Community Champion
Community Champion

Try replacing that last argument with a DATE() formula.





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

Proud to be a Super User!




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.

Top Solution Authors
Top Kudoed Authors