cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
sandip Frequent Visitor
Frequent Visitor

Which one Dax is better?

Hi,

I am using below 2 DAX expressions:

 

1. SUMX(FILTER('SAVO_QBR_TEMP', ('SAVO_QBR_TEMP'[CNT_ID]="N" || 'SAVO_QBR_TEMP'[Returns Contract_Indicator]="N" || 'SAVO_QBR_TEMP'[Contract_Indicator] = "N") && ('SAVO_QBR_TEMP'[RX]="Y")), 'SAVO_QBR_TEMP'[MI EXT$])

 

2. CALCULATE(SUM('SAVO_QBR_TEMP'[MI EXT$]), FILTER('SAVO_QBR_TEMP', ('SAVO_QBR_TEMP'[CNT_ID]="N" || 'SAVO_QBR_TEMP'[Returns Contract_Indicator]="N" || 'SAVO_QBR_TEMP'[Contract_Indicator] = "N") && ('SAVO_QBR_TEMP'[RX]="Y")))

 

Please let me know which one is better in respect of performance? as I am new in power bi.

1 ACCEPTED SOLUTION

Accepted Solutions
Super User
Super User

Re: Which one Dax is better?

Hi @sandip 

2. As it is using Context Transition 

Measure 2 = 
CALCULATE(
    SUM( SAVO_QBR_TEMP[MI EXT$] ), 
    SAVO_QBR_TEMP'[RX] = "Y",
    FILTER(
        SAVO_QBR_TEMP, 
        SAVO_QBR_TEMP[CNT_ID] = "N" 
            || SAVO_QBR_TEMP[Returns Contract_Indicator] = "N" 
            || SAVO_QBR_TEMP[Contract_Indicator] = "N"
    )
)

Regards,
Mariusz

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. 

3 REPLIES 3
Super User
Super User

Re: Which one Dax is better?

Hi @sandip 

2. As it is using Context Transition 

Measure 2 = 
CALCULATE(
    SUM( SAVO_QBR_TEMP[MI EXT$] ), 
    SAVO_QBR_TEMP'[RX] = "Y",
    FILTER(
        SAVO_QBR_TEMP, 
        SAVO_QBR_TEMP[CNT_ID] = "N" 
            || SAVO_QBR_TEMP[Returns Contract_Indicator] = "N" 
            || SAVO_QBR_TEMP[Contract_Indicator] = "N"
    )
)

Regards,
Mariusz

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. 

sandip Frequent Visitor
Frequent Visitor

Re: Which one Dax is better?

Hi,

You have mentioned the below filter condition out of the filter function:

SAVO_QBR_TEMP'[RX] = "Y",

so that does mean that it will work as "AND" with rest of the conditions?

Super User
Super User

Re: Which one Dax is better?

Hi @sandip 

Yes, technically it does the same thing

 

Regards,
Mariusz

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Back to School Contest

Back to School Contest

Engage and empower students with Power BI!

MBAS Gallery

Watch Sessions On Demand!

Continue your learning in our online communities.

Summit Australia 2019

Summit Australia 2019

Travel to Melbourne and network with thousands of peers!

Top Ideas
Users Online
Currently online: 117 members 1,585 guests
Please welcome our newest community members: