Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago
Solved

Refactoring DAX Query using USERELATIONSHIP

I have written this DAX query but it takes quite a long time to render, is there anyway I can refactor this to return the result on the card visual faster?

postVPP = 
VAR currentMonth = DATE(YEAR(today()), month(today()), 1)
RETURN
COALESCE (
    CALCULATE (
        DIVIDE ( [sumOfVendor], [Total Partners], 0 ),
        USERELATIONSHIP ( 'Channel Table'[partner_key], fact_transaction_monthly[transaction_monthly_partner_key] ),
        fact_transaction_monthly[transaction_monthly_charge_created_date] >= currentMonth
       
    ),
    0

 

  • Hi, Anonymous 

    I don't think this part can be further optimized.

    This code is clear, understandable and maintainable enough.

    You may need to check your current data model and other referenced mesures.

    Best Regards,
    Community Support Team _ Easo

     

     

1 Reply

  • v-easonf-msft's avatar
    v-easonf-msft
    Community Support

    Hi, Anonymous 

    I don't think this part can be further optimized.

    This code is clear, understandable and maintainable enough.

    You may need to check your current data model and other referenced mesures.

    Best Regards,
    Community Support Team _ Easo