Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

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.

1 REPLY 1
v-piga-msft
Resident Rockstar
Resident Rockstar

Hi @Anonymous,

 

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.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.