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. 

View solution in original post

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. 

View solution in original post

Highlighted
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
Can You Solve These Challenge

Challenge: Can You Solve These?

Find out how to participate in the first Power BI 'Can You Solve These?' challenge.

Community News & Announcements

Community News & Announcements

Get your latest community news and announcements.

Virtual Launch Event

Microsoft Business Applications October Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

Community Kudopalooza

Win Power BI Swag with Community Kudopalooza!

Each week, complete activities and be qualified in the drawing for cool Power BI Swag.

Users Online
Currently online: 43 members 1,080 guests
Please welcome our newest community members: