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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
katieandemil
Frequent Visitor

Slow DAX with a variable

 

Hi,

I've come across now several times and issue in performance when I use a variable, and it's odd because I had issue or large table, but recently on a new project I've used it on a small table and the same issue.

 

The DAX should simply display results for each month (1 year only) and filter the data using month max date.

Simple, but it takes over 40 seconds with a variable and when I try date (which only works for 1 month) is very fast.

 

I've also try to combine date function with max (code below), just too see if there is a difference. No difference, still slow.

 

Please see below DAX example

 

Test Measure =
var SlowOver40sec = max(DimDate[Date]) + 1
var SlowTooOver40sec = DATE(2019,month(max(DimDate[Date])+ 1 ),1)
var FastBelow1sec = DATE(2019,4,1)
RETURN
CALCULATE(SUMX('Historical Table',1)
,'Historical Table'[ChangeDateTime]< FastBelow1sec
,all(DimDate))

 

I would appreciate any explanation of why it's so slow with a variable.

 

0 REPLIES 0

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.