Anonymous
Not applicable

Calculate last 6 months sales value using temporary date table

Hey there! I'm diving into DAX and trying to visualize the sales for the last 6 months. I've got this Date_Master table and made a copy named temp_date_master.. The relationship between the Date_Master and Temp_Date_Master was many-to-one. (The video explaining the process ). I have done the following measure

Last_6_Months_Sales = 
var referenceDate = Max('Date Master'[Date])
var referenceDate1 = EOMONTH(referenceDate, -1)
var previousDates = 
    DATESINPERIOD('Temp_Date_Master'[Date],
    referenceDate1 ,
    -6,
    MONTH
    )
VAR Result = 
    CALCULATE(
        [Sales Value],
        REMOVEFILTERS('Date Master'),
        KEEPFILTERS(previousDates),
        USERELATIONSHIP('Date Master'[Date], 'Temp_Date_Master'[Date]))

Return 
    Result

I wanted to convert the relationship between the date_master and temp_date_master to be one-to-many relationship (I am trying it as im losing hierarchy of 'Date Master'[Date] as the column is the "many" side of a model relationship). How to solve this issue?