cancel
Showing results for
Did you mean:
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.

Highlighted
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,

Cherry

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.

Announcements

#### Community Highlights

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

#### Power Platform Summit North America

Register by September 5 to save \$200

#### 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.

#### Watch Sessions On Demand!

Continue your learning in our online communities.

Top Kudoed Authors
Users Online
Currently online: 360 members 4,115 guests
Recent signins: