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

The Power BI Data Visualization World Championships is back! It's time to submit your entry. Live now!

Reply
Shafi293
Frequent Visitor

How to optimize below DAX

Hi guys can u plz help me out with the  below query ,it takes around more than 50sec to show results 
w1 =
CALCULATE([SettlementAmountm],
Filter(Fact_Revenue_management,
if(ISBLANK(Fact_Revenue_management[BankTransactionDate].[Date] ), MAX(DimDate[Date]), Fact_Revenue_management[BankTransactionDate].[Date]) <= Fact_Revenue_management[PaymentDueDate].[Date]
&&
 Fact_Revenue_management
[ReconFlagForBank] = BLANK() || max(DimDate[Date]) < Fact_Revenue_management[BankTransactionDate].[Date]
&&
Fact_Revenue_management[DimPaymentGatewayID]<>21 && Fact_Revenue_management[DimPaymentGatewayID]<>14 ))

+
CALCULATE([Paypal Outstanding],Filter((Fact_Revenue_management),
if(ISBLANK(Fact_Revenue_management[BankTransactionDate].[Date] ), MAX(DimDate[Date]), Fact_Revenue_management[BankTransactionDate].[Date]) <= Fact_Revenue_management[PaymentDueDate].[Date] && ( Fact_Revenue_management
[ReconFlagForBank] = BLANK() || max(DimDate[Date]) < Fact_Revenue_management[BankTransactionDate].[Date]) && Fact_Revenue_management[DimPaymentGatewayID]=14 ))

other measures used are 
SettlementAmountm =
Calculate(Sum(Fact_Revenue_management[SettlementAmount]),Fact_Revenue_management[DimPaymentGatewayID] <>14,FIlter(DimPaymentGateway,DimPaymentGateway[TFPaymentID]="True" && DimPaymentGateway[DimPaymentGatewayID] <>21 && DimPaymentGateway[DimPaymentGatewayID] <>14))
+
[Paypal settlement]
+
Calculate(Sum(Fact_Revenue_management[SettlementAmount]),FIlter(DimPaymentGateway,DimPaymentGateway[TFPaymentID]="False" ))
+CALCULATE(Sum(Roku[TransactionAmount]),Filter(DimPaymentGateway,DimPaymentGateway[DimPaymentGatewayID]=21))

1 ACCEPTED SOLUTION
v-frfei-msft
Community Support
Community Support

Hi @Shafi293,

 

Please refer to this video.

https://sqlbits.com/Sessions/Event12/Optimizing_Analyzing_DAX_Query_Plans

 

Regards,

Frank

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.

View solution in original post

3 REPLIES 3
v-frfei-msft
Community Support
Community Support

Hi @Shafi293,

 

Please refer to this video.

https://sqlbits.com/Sessions/Event12/Optimizing_Analyzing_DAX_Query_Plans

 

Regards,

Frank

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.
luxpbi
Helper V
Helper V

Can you please share some sample data ?

 

Thank you

Thanx for your time guys ,ill try to privide sample data for better understanding .

Helpful resources

Announcements
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.