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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Anonymous
Not applicable

Is there a way i can modify this DAX query to improve the performance

Hi All, I am using this logic is there a way if I can improve the performance of the report.

 

Table final =
var policy1 = (SELECTCOLUMNS(FILTER('TABLEBI',TABLEBI[ColumnA] in SELECTCOLUMNS (FILTER('TABLEBI',TABLEBI[ORIGINAL] in SELECTCOLUMNS (  FILTER ( 'TABLEBI',TABLEBI[POLICY]= "VALUE"),"T1" ,TABLEBI[ORIGINAL] ) && TABLEBI[ORIGINAL] <> ""),"Pol", TABLEBI[ColumnA])&& TABLEBI[ColumnA] <> ""),
"policy",TABLEBI[POLICY]) )

 

var policy2 = (SELECTCOLUMNS(filter(TABLEBI,TABLEBI[ORIGINAL] in (SELECTCOLUMNS(FILTER(TABLEBI,TABLEBI[POLICY] in (SELECTCOLUMNS(FILTER( TABLECL,TABLECL[COLUMNB] in (SELECTCOLUMNS ( FILTER ( 'TABLECL', TABLECL[POLICY]="VALUE"),"COLUMNC" ,TABLECL[COLUMNB]))),"policy",TABLECL[POLICY]))),"org",TABLEBI[ORIGINAL]))),
"pol",TABLEBI[POLICY]))

return (

SUMMARIZECOLUMNS(

'TABLECL'[POLICY],

'TABLECL'[COLUMNC],

'TABLEBI'[ORIGINAL],

'TABLEBI'[PreviousPOLICY],

'TABLEBI'[ColumnA],

 


'TABLECL'[COLUMND],

'TABLECL'[COLUMNB],

filter(All(TABLECL),TABLECL[POLICY] in policy1
||
'TABLECL'[POLICY] in (SELECTCOLUMNS(FILTER(TABLEBI,TABLEBI[ColumnA] in (SELECTCOLUMNS(FILTER(TABLEBI,TABLEBI[POLICY] in policy2),"pol",TABLEBI[ColumnA])) && TABLEBI[ColumnA] <> ""),"TABLEBI",TABLEBI[POLICY]))

||
TABLECL[POLICY] in policy2
||
TABLECL[POLICY] in
(SELECTCOLUMNS(FILTER(TABLECL,TABLECL[COLUMNB] in (SELECTCOLUMNS(FILTER(TABLECL,TABLECL[POLICY] in (SELECTCOLUMNS(FILTER(TABLEBI,TABLEBI[ORIGINAL] in  (SELECTCOLUMNS(FILTER(TABLEBI,TABLEBI[ColumnA] in SELECTCOLUMNS (FILTER('TABLEBI',TABLEBI[POLICY] in policy2),"Pol", TABLEBI[ColumnA])&& TABLEBI[ColumnA] <> ""),"policy",TABLEBI[ORIGINAL]) )),"pol",TABLEBI[POLICY]))),
 "insured",TABLECL[COLUMNB]))), "policy",TABLECL[POLICY]))
),

"AMOUNT", 'TABLEBI_Premium'[AMOUNT],

"TotalVALUE", 'TABLECL'[TOTALVALUE]
 )
)

 

 

1 REPLY 1
some_bih
Super User
Super User

Hi @Anonymous  one of possible solution is below (using AI) 🙂 I hope this help at least like idea

 

VAR Policy1 =

CALCULATETABLE(

        VALUES('TABLEBI'[POLICY]), 'TABLEBI'[ORIGINAL] <> "",

      'TABLEBI'[POLICY] = "VALUE", 'TABLEBI'[ColumnA] <> ""

)

VAR Policy2 =

          CALCULATETABLE( VALUES('TABLEBI'[POLICY]),

         'TABLEBI'[ColumnA] <> "", 'TABLEBI'[POLICY] IN ( CALCULATETABLE( VALUES('TABLECL'[COLUMNB]),         'TABLECL'[POLICY] = "VALUE" ) ) )

RETURN

SUMMARIZE( FILTER( CROSSJOIN('TABLECL', 'TABLEBI'),

      ( 'TABLECL'[POLICY] IN Policy1 || 'TABLECL'[POLICY] IN Policy2 || 'TABLECL'[COLUMNB] IN Policy2 ) &&                        'TABLEBI'[ColumnA] <> "" ), 'TABLECL'[POLICY], 'TABLECL'[COLUMNC], 'TABLEBI'[ORIGINAL],                      'TABLEBI'[PreviousPOLICY], 'TABLEBI'[ColumnA], 'TABLECL'[COLUMND], 'TABLECL'[COLUMNB], 'TABLEBI_Premium'[AMOUNT], 'TABLECL'[TOTALVALUE] )





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!






Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.