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
dniedrauer
Resolver I
Resolver I

YTD functions for Items with no sales YTD

The time intelligence in Power BI is nice, but I'm having issues with it that, either way, requires a manual input in specify the year meant by "year to date." 

 

Here's the scenario: 

 

100 products in the data set

80 were sold in both 2017 and 2016

15 were sold in 2016 but not 2017

5 were sold in 2017 but not 2016

 

calculate(sum(sales usd),datesytd('table' [period]) has ytd sales for all 100 products...which is misleading. But, of course, in aggregate, the total sales ytd would be correct under this formula. 

 

I have a workaround that involves current year ---> calculate([sumofsales],'calendar'[year]="2017") and last year to date = (calculate([sumofsales],'calendar'[year]="2016")/12)*calculate(distinctcount('main'[period]),datesytd('main'[period]) but then why even bother with the time intelligence functions? 

 

 

4 REPLIES 4
Eric_Zhang
Employee
Employee


@dniedrauer wrote:

The time intelligence in Power BI is nice, but I'm having issues with it that, either way, requires a manual input in specify the year meant by "year to date." 

 

Here's the scenario: 

 

100 products in the data set

80 were sold in both 2017 and 2016

15 were sold in 2016 but not 2017

5 were sold in 2017 but not 2016

 

calculate(sum(sales usd),datesytd('table' [period]) has ytd sales for all 100 products...which is misleading. But, of course, in aggregate, the total sales ytd would be correct under this formula. 

 

I have a workaround that involves current year ---> calculate([sumofsales],'calendar'[year]="2017") and last year to date = (calculate([sumofsales],'calendar'[year]="2016")/12)*calculate(distinctcount('main'[period]),datesytd('main'[period]) but then why even bother with the time intelligence functions? 

 

 


@dniedrauer

Would you mind post any sample data(in plain text) and expected output?

Is your Table[period] a date table?

No, not in this case. It doesn't seem to make a difference though. 

The time intelligence functions will not work properly without a full date table, with a row for every date in the range of your data.  Try creating a date table and linking to your fact table and see if you can get the functions to work.

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.