Forum Discussion

FelipeGualberto's avatar
FelipeGualberto
Frequent Visitor
8 years ago
Solved

Filter and divide instead filtering twice with CALCULATE

Hello, I have the measure below and it works fine:   Televisions Price per Unit = CALCULATE([Revenue]; DB[Product] = "Television") / CALCULATE([Amount]; DB[Product] = "Television")   I wonder if ...
  • Greg_Deckler's avatar
    8 years ago

    So something like:

     

    Televisions Price per Unit = 
    VAR __tmpTable = FILTER('DB',[Product]="Television")
    RETURN 
    DIVIDE(
        SUMX(__tmpTable,[Revenue]),
        SUMX(__tmpTable,[Amount]),
        0
    )