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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
sandip
Helper III
Helper III

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
Mariusz
Community Champion
Community Champion

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
Mariusz
Community Champion
Community Champion

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. 

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?

Mariusz
Community Champion
Community Champion

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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