Forum Discussion
Anonymous
7 years agoNot applicable
Pass two Date Ranges into DAX Formula
Hello! My client wants to be able to input two dates to calculate sales for two periods, and then calculate the Delta %. The problem I'm having is how to incorporate two Date Parameters into the ...
Anonymous
7 years agoNot applicable
Growth % = var __periodBefore = TREATAS( VALUES( BeforeSlicer[Date] ), 'Dates'[Date] ) var __periodAfter = TREATAS( VALUES( AfterSlicer[Date] ), 'Dates'[Date] ) var __beforeGrossSales = CALCULATE( [Gross Sales], __periodBefore ) var __afterGrossSales = CALCULATE( [Gross Sales], __afterPeriod ) var __growth = DIVIDE( __afterGrossSales - __beforeGrossSales, __beforeGrossSales ) RETURN __growth
Best
Darek
Quinnie2017
3 years agoHelper II
This is helpful! May I ask how you named the slicers as in the following statements? Stated another way, not sure how to name my slicers as "BeforeSlicer" and "AfterSlicer". Perhaps as a named variable?
Growth % = var __periodBefore = TREATAS( VALUES( BeforeSlicer[Date] ), 'Dates'[Date] ) var __periodAfter = TREATAS( VALUES( AfterSlicer[Date] ), 'Dates'[Date]