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
Would you have any suggestions on how to best utilize INTERSET in this scenario? I don't quite see how that function fits as a replacement for TREATAS. We're using a tabular model.
Anonymous
7 years agoNot applicable
Growth % = var __periodBefore = INTERSECT( VALUES( BeforeSlicer[Date] ),
-- You might need to replace ALL (...) with VALUES(...) depending on what your needs are.
-- If you do, then it means you'll respect any existing selections on the Dates dimension.
-- Using ALL ( ... ) only transfers the selection from BeforeSlicer and removes any filters
-- coming from Dates itself. You have to decide which behviour fits your req's. Same is
-- true for the AfterSlicer. ALL( 'Dates'[Date] ) ) var __periodAfter = INTERSECT( VALUES( AfterSlicer[Date] ), ALL ( 'Dates'[Date] ) ) var __beforeGrossSales = CALCULATE( [Gross Sales], __periodBefore ) var __afterGrossSales = CALCULATE( [Gross Sales], __afterPeriod ) var __growth = DIVIDE( __afterGrossSales - __beforeGrossSales, __beforeGrossSales ) RETURN __growth
Best
Darek