Hi, I need to create Measure that calculates median price between [Sale price1] and [Sale price2] based on Sale date1 and Sale date2. Following is the output I am looking for. I have created new Inactive relationship between Sale date2 and Dim date and active relation between Sale date1 and Dim date.
I have created following DAX but its not working as expected.
Dax: Price2 % difference from Price1 =
VAR __BASELINE_VALUE = SUM('Fact Sale'[Price1]) VAR __VALUE_TO_COMPARE = CALCULATE(SUM('Fact Sale'[Price2]), USERELATIONSHIP('Fact Sale'[Saledate2],DimDate[Date]) ,KEEPFILTERS(DimDate[Date] >= DATE(2010,01,01) && DimDate[Date] < DATE(2015,01,01) ) ) RETURN IF( NOT ISBLANK(__VALUE_TO_COMPARE), DIVIDE(__VALUE_TO_COMPARE - __BASELINE_VALUE, __BASELINE_VALUE) )