Quantcast
Channel: Desktop topics
Viewing all articles
Browse latest Browse all 217083

YTD measure based on different date fields

$
0
0

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


Viewing all articles
Browse latest Browse all 217083

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>