Forum Discussion

matsahiro's avatar
matsahiro
Helper II
5 years ago
Solved

DAX Code to Show Data Changes

I'm trying to display top performing products where the price is greater than 50 and the quantity sold is greater than 60. The table is only supposed to display our products that meet this requiremen...
  • CNENFRNL's avatar
    5 years ago

    matsahiro , your question is interesting and the solution is tricky.

    First of all, it's for sure that items in Product column is unique since it's an aggregated monthly sales report. Thus, a 1:1 relationship can be created between any of two reports this way,

     

    Accordingly, the measure is

    Dropped / Added = 
    SWITCH (
        TRUE (),
        ISEMPTY ( CALCULATETABLE ( Previous ) ), "Added",
        MAX ( 'Current'[Price] ) < 50, "Dropped - Due to Price",
        MAX ( 'Current'[Quantity Sold] ) < 60, "Dropped - Due to Quantity Sold",
        ""
    )