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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
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
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?

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.