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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Anonymous
Not applicable

How can i optimized this dax without using summarize. This is taking too much time to load.

Single Tran1 =
Var table1=
SUMMARIZE(
FILTER(V_STORE_TRAN_FACT,'V_STORE_TRAN_FACT'[Year]=[FY] && 'V_STORE_TRAN_FACT'[Week2]=[WK] ),
V_STORE_TRAN_FACT[STORE_KEY],
V_STORE_TRAN_FACT[TRANSACTIONID],
"T1",Sum('V_STORE_TRAN_FACT'[TRANS_QTY]))
Return
COUNTX(FILTER(table1,[T1]=1),[TRANSACTIONID])

1 REPLY 1
tamerj1
Super User
Super User

Hi @Anonymous 

Actually, the inner FILTER is the oart of the code that consumes most of the time. It includes the evaluation of two measures at each iteration. I see that this filter is absolutely not required. The table is already filtered by the year and week available in the current filter context. 
I guess by removing it, the results shall remain unchanged. 
Single Tran1 =
VAR table1 =
SUMMARIZE (
V_STORE_TRAN_FACT,
V_STORE_TRAN_FACT[STORE_KEY],
V_STORE_TRAN_FACT[TRANSACTIONID],
"T1", SUM ( 'V_STORE_TRAN_FACT'[TRANS_QTY] )
)
RETURN
COUNTROWS ( FILTER ( table1, [T1] = 1 ) )

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

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