Search code examples
powerbipowerbi-desktoppowerbi-embeddedpowerbi-datasourcepowerbi-custom-visuals

Filtered table through Calculate Table


I have filtered the table by creating a new one in the following way:

CalculateTable(Sales,Filter(Sales,Sales[Amount]>500), FILTER(Sales,Sales[Product] IN {"A","B"})

However, beside the general consition (Amount>500), I also need to add a condition with if. If product is A, then Amount must be more than 600, if product is B, then Amount must be greater than 650.

I have tried something like CalculateTable(Sales,Filter(Sales,Sales[Amount]>500),Filter(Sales,Sales[Amount]>600) IF Sales[Product]="A")

but it is not working. Could you help me, please? Thank you in advance!


Solution

  • A fast solution will be:

    FILTER(
        Sales
       ,[Amount]>500 && [Product]="A" || [Amount]>600 && [Product]="B"
    )
    

    FILTER, CALCULATE, CALCULATETABLE costs resources and it is influencing speed of a measure. So, try to use it as less as possible.