Showing results for 
Search instead for 
Did you mean: 
dwilderman Frequent Visitor
Frequent Visitor

Automated DAX time period calculation

I'm not sure if this will make sense (so apologies in advance if this is gibberish) but I keep getting stuck on what initially seemed like a simple calculation. In essence, I have an existing DAX statement to calculate turnover. This represents the "true" turnover being measured. What I'd like to do is create another DAX, which can dynamically filter out a specific group from a specific timeperiod.


For example, if an entire location closes in calendar year 2018, I want to be able to show turnover without the one-time spike of the closure being factored into the equation for that year. The challenge is that it needs to be factored out only during that specific time period where it occurs. Turnover at that location should be still counted in prior time periods (calendar years prior to 2018) where the site was operational and experienced turnover like any other location.


Quick Facts = Data pulls from 3 tables: 1) Date Table; 2) Locations Table; 3) People Table


True turnover calculation

SUMX(ALLSELECTED('date'[fiscal_month]),[Term Total]/[Active Total MonthlyAvg])


Turnover Exclusion (This is the one I'd like to make dynamic instead of hardcoded)

CALCULATE(SUMX(ALLSELECTED('date'[fiscal_month]),[Term Total]/[Active Total MonthlyAvg]),(Locations[Site Name]="JobSiteX"),'date'[fiscal_year]=2018)


To end up with something like this

SUMX(ALLSELECTED('date'[fiscal_month]),[Term Total]/[Active Total MonthlyAvg])


CALCULATE(SUMX(ALLSELECTED('date'[fiscal_month]),[Term Total]/[Active Total MonthlyAvg]),(Locations[Site Name]="JobSiteX"),'date'[fiscal_year]=2018)


My revised calculation isn't dynamic though which ultimately is the problem. This means that when I look at calendar year 2017, I'll still be incorrectly subtracting 2018 turnover from JobSiteX when instead I want it to look at calendar year to determine whether to remove the one-time event.

Community Support Team
Community Support Team

Re: Automated DAX time period calculation

Hi @dwilderman,


More details will be more helpful.


If it is convenient, could you share some data sample which could reproduce your scenario so that I can copy and test.


Best  Regards,


Community Support Team _ Cherry Gao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Community Highlights

Community Highlights

Find out what's new in the Power BI Community!

Summit North America

Power Platform Summit North America

Register by September 5 to save $200

Virtual Launch Event

Microsoft Business Applications Virtual Launch Event

Watch the event on demand for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

MBAS Gallery

Watch Sessions On Demand!

Continue your learning in our online communities.

Users Online
Currently online: 360 members 4,115 guests
Please welcome our newest community members: