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
errorssuck
Frequent Visitor

YTD measure based on different date fields

Hi,

 

I have a Fact table with 2 date fields. One is a Date field(20170101) and the other is Month field (201701) and I have created a relationship between this fact table with 2 copies of date table. Like as shown below: Now, I am trying to create one YTD measure on Qty field that should work with Month and Year columns in both date tables (Payment Month and Purchase Date).

 

I marked Payment Month and Purchase Date tables as date tables in PowerPivot and wrote the following DAX which seems to working in PowerPivot but doesnt work in PowerBI or SSAS tabular for some reason. 

 

Sales_YTD2:=CALCULATE([TotalSales],DATESYTD('PurchaseDate'[Date]),DATESYTD('PaymentMonth'[MonthEndDate]))

 

(where TotalSales = Sum(Qty))

 

Any help with the DAX is greatly appreciated.!!!

 

Re.PNG

1 REPLY 1
v-ljerr-msft
Employee
Employee

Hi @errorssuck,

 

Does your "PaymentMonth" table have a date column which contains continuous dates? Or it only contains month end dates?

 

As most Time Intelligence Functions (DAX) require an individual and continuous date table to work correctly, please make sure both of your date table have a continuous date column.Smiley Happy

 

Regards

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.