cancel
Showing results for
Did you mean:

Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.

Frequent Visitor

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
Super User

@mynameisrichard , 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-tr...
Power BI HR Active Employee Tenure Bucketing, and Hired, Terminated, and Active employees: https://youtu.be/fvgcx8QLqZU

Frequent Visitor

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?

Announcements

#### Power BI Monthly Update - November 2023

Check out the November 2023 Power BI update to learn about new features.

#### Fabric Community News unified experience

Read the latest Fabric Community announcements, including updates on Power BI, Synapse, Data Factory and Data Activator.

#### Exclusive opportunity for Women!

Join us for a free, hands-on Microsoft workshop led by women trainers for women where you will learn how to build a Dashboard in a Day!

#### The largest Power BI and Fabric virtual conference

130+ sessions, 130+ speakers, Product managers, MVPs, and experts. All about Power BI and Fabric. Attend online or watch the recordings.

Top Solution Authors
Top Kudoed Authors