Reply
avatar user
Anonymous
Not applicable

Speed this up! (please!)

I have a basic data model with 4 tables: 1 fact table and 3 dimensions table. One of the dimension tables is a date table. The fact table contains c. 1.1 million rows.

 

This is the measure I would like to optimise, if possible:

 

 

 

 

VAR WeekEnding = SELECTEDVALUE(Dates[FinancialWeekEnding],MAX(Dates[FinancialWeekEnding]))


RETURN
CALCULATE(COUNTROWS(Fact),
            ALL(Dates),
            Fact[Completed Date Calculated] > WeekEnding || ISBLANK(Fact[Completed Date Calculated]),
            Fact[IssuedDate] <= WeekEnding,
            Fact[Cancelled Date Calculated] > WeekEnding || ISBLANK(Fact[Cancelled Date Calculated])
)

 

 

 

 

The purpose is to place to measure on a line chart with dates on the x axis and the result will show the number of open cases in the Fact table at the date - my logic is get the date at the data point, remove filters from the Dates table and then check if the case was created on or before said date and was either not cancelled or cancelled after and not closed or closed after. As I type, I wonder if REMOVEFILTERS would be quicker than ALL..

 

Measure currently calculates in about a minute but responded very slowly, or not at all, to slicers. Any ideas to improve this calculation time? Thanks.

2 REPLIES 2
amitchandak
Super User
Super User

@Anonymous , Try like

 

VAR WeekEnding = SELECTEDVALUE(Dates[FinancialWeekEnding],MAX(Dates[FinancialWeekEnding]))


RETURN
CALCULATE(COUNTROWS(Fact),
filter(Fact,
Fact[Completed Date Calculated] > WeekEnding || ISBLANK(Fact[Completed Date Calculated]),
Fact[IssuedDate] <= WeekEnding,
Fact[Cancelled Date Calculated] > WeekEnding || ISBLANK(Fact[Cancelled Date Calculated])
), all(Date) )


or use crossfilter to remove the join

example

Power BI: HR Analytics - Employees as on Date : https://youtu.be/e6Y-l_JtCq4
https://community.powerbi.com/t5/Community-Blog/HR-Analytics-Active-Employee-Hire-and-Termination-trend/ba-p/882970
Power BI HR Active Employee Tenure Bucketing, and Hired, Terminated, and Active employees: https://youtu.be/fvgcx8QLqZU

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
avatar user
Anonymous
Not applicable

Hi, I am not sure that is going to work as FILTER accepts 2 arguments only?

 

I can remove the commas and replace with && but that just returns a blank value. I'm not sure why using FILTER would improve the calcualtion speed?

avatar user

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

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

Top Solution Authors (Last Month)
Top Kudoed Authors (Last Month)