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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
dancarr22
Helper V
Helper V

COUNTX running very slow - anyway to improve performance?

Hello,

 

We are calculating XIRR in PBI.  There are several associated measures.

Some of the measures run slow - example of one below.  Any idea how to speed up or why this is occurring?  Relatively speaking, there are not many records in the table - about 500k.  And we use DirectQuery.

Slow running measure is:

XIRR_BeginRMV_Date_IsBefore = VAR StartDate = [XIRR_BeginDate]

VAR HowMany  = CALCULATE(COUNTX(XIRR_Lookup,XIRR_Lookup[TransactionDate]),XIRR_Lookup[MappingName]="Reported Market Value", XIRR_Lookup[TransactionDate]<StartDate)

RETURN IF(COALESCE(HowMany,0)=0,"AFTER","BEFORE")

 

And mainly the slow part is VAR HowMany.

 

Thanks,

Dan 

1 ACCEPTED SOLUTION
tamerj1
Super User
Super User

Hi @dancarr22 

please try

XIRR_BeginRMV_Date_IsBefore =
VAR StartDate = [XIRR_BeginDate]
VAR Check =
ISEMPTY (
FILTER (
XIRR_Lookup,
XIRR_Lookup[MappingName] = "Reported Market Value"
&& XIRR_Lookup[TransactionDate] < StartDate
)
)
RETURN
IF ( Check, "AFTER", "BEFORE" )

View solution in original post

2 REPLIES 2
dancarr22
Helper V
Helper V

Thanks so much @tamerj1 - that worked!

I actually have one (maybe 2) new related questions which I will post separately.

Sincerely appreciate your assistance!
Dan

tamerj1
Super User
Super User

Hi @dancarr22 

please try

XIRR_BeginRMV_Date_IsBefore =
VAR StartDate = [XIRR_BeginDate]
VAR Check =
ISEMPTY (
FILTER (
XIRR_Lookup,
XIRR_Lookup[MappingName] = "Reported Market Value"
&& XIRR_Lookup[TransactionDate] < StartDate
)
)
RETURN
IF ( Check, "AFTER", "BEFORE" )

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.