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

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

Reply
Pikachu-Power
Impactful Individual
Impactful Individual

Slow performance in Matrix / Measure optimization

Hello community,

 

I created a matrix and the results are fine. But when I switch slicer from 2020 to 2021 it takes 14000 ms. When I enable the subtotals 6600 ms. Is that normal or would some optimization of the measures help?

 

I have a table with start and end dates. calculate a new end date:

 

Measure1 =
IF (
    MAX(TABLE[END_DATE]) = BLANK(),
    DATE(SELECTEDVALUE(CALENDER[YEAR]), 12, 31 ),
    IF (
        MAX(TABLE[END_DATE]) <= DATE(SELECTEDVALUE(CALENDER[YEAR]), 12, 31),
        MAX(TABLE[END_DATE]),
        DATE(SELECTEDVALUE(CALENDER[YEAR]), 12, 31)
       )
    )
 
Then a  lengh of time
 
Measure2 =
DATEDIFF(MAX(TABLE[START_DATE]), [Measure1], DAY) / 365
 
Then a aggregation
 
Measure3=
AVERAGEX(FILTER(TABLE, [Measure2] > 0) , [Measure2])
 
In the Matrix I show two columns. A Group and the Measure3 values. 
 
Someone who see a possibility to make the measures faster? Would be interessting to know. 
 
Thanks.
1 ACCEPTED SOLUTION
johnt75
Super User
Super User

Using variables might improve performance

Measure1 =
VAR MaxEndDate =
    MAX ( TABLE[END_DATE] )
VAR YearEnd =
    DATE ( SELECTEDVALUE ( CALENDER[YEAR] ), 12, 31 )
RETURN
    IF (
        ISBLANK ( MaxEndDate ),
        YearEnd,
        IF ( MaxEndDate <= YearEnd, MaxEndDate, YearEnd )
    )

View solution in original post

2 REPLIES 2
johnt75
Super User
Super User

Using variables might improve performance

Measure1 =
VAR MaxEndDate =
    MAX ( TABLE[END_DATE] )
VAR YearEnd =
    DATE ( SELECTEDVALUE ( CALENDER[YEAR] ), 12, 31 )
RETURN
    IF (
        ISBLANK ( MaxEndDate ),
        YearEnd,
        IF ( MaxEndDate <= YearEnd, MaxEndDate, YearEnd )
    )

Interessting. It gets double faster. Thx!

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

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.

Top Solution Authors