Forum Discussion

eliasayyy's avatar
eliasayyy
Memorable Member
3 years ago
Solved

Issue With Table Performance

I am building a sales table  when i add simple calculations i have a fast perfromance as soon as i added "Price" it became very slow and sometime it give an error   my m...
  • OwenAuger's avatar
    OwenAuger
    3 years ago

    Hi again eliasayyy 

    Thanks for that 🙂
    I'm thinking an acceptable solution may just be to only display the [new Price] and [Final Price]  measures if Sales is nonempty.

     

    The underlying issue is that the measures are based on Item and Price Change tables that are not filtered by Customer, so will return a result for every Customer when Customer Name is included in the visual. We can restrict the combinations of Item/Customer by including only those combinations that occur in Sales, by checking if Sales is nonempty.

     

    new Price = 
    IF (
        NOT ISEMPTY ( Sales ),
        MAX('Price Change'[Accumulated]) * MAX(Items[Item Price])
    )

    Note: Used COALESCE as alternative to IF.

    Final Price = 
    IF (
        NOT ISEMPTY (Sales ),
        VAR NewPrice = [new Price]
        RETURN
            COALESCE ( NewPrice, MAX ( Items[Item Price] ) )
    )

     

    Does this or something similar work for you?

     

    Updated PBIX attached.

     

    Regards,

    Owen