Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hi,
I have the following measure:
Measure =
CALCULATE (
COUNT ( 'Table'[Value] ),
FILTER (
ALL ( 'Table' ),
'Table'[ValidFromDate] < MAX ( 'Date'[Date] ) &&
'Table'[ValidToDate] > MAX ( 'Date'[Date] )
)
)
The two tables (Table, Date) are not connected.
I use this to see "Active" contracts on a specific date. However when I place it in a visual to see it on a daily basis (last 12 months for example), it is way too slow (I have 12 million rows).
Is there a way to optimize this?
Much appreciated!
Perhaps there is a way to make it faster without using Calculate? @Greg_Deckler Any ideas?
Yeah, I have seen this pattern be slow occasionally.
Without CALCULATE can be written fairly similarly.
Measure =
VAR _MaxDate = MAX ( 'Date'[Date] )
RETURN
COUNTROWS (
FILTER (
ALL ( 'Table' ),
'Table'[ValidFromDate] < _MaxDate &&
'Table'[ValidToDate] > _MaxDate
)
)
It might help to make the max date a variable.
Measure =
VAR _MaxDate = MAX ( 'Date'[Date] )
RETURN
CALCULATE (
COUNT ( 'Table'[Value] ),
ALL ( 'Table' ),
'Table'[ValidFromDate] < _MaxDate,
'Table'[ValidToDate] > _MaxDate
)
Thanks but that doesn't help.
Check out the July 2025 Power BI update to learn about new features.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
User | Count |
---|---|
18 | |
7 | |
6 | |
5 | |
5 |
User | Count |
---|---|
23 | |
10 | |
10 | |
9 | |
7 |