Forum Discussion

MNGoodyear's avatar
MNGoodyear
Frequent Visitor
7 years ago
Solved

filtering using calculated fields

  I have sales order data by account/year/commodity/rep /order reference etc...    I want to create an interactive enquiry where the user can ask quesitons of the data. For example   Using the b...
  • AlB's avatar
    AlB
    7 years ago

    MNGoodyear

     

    If I understand correctly you want a sort of dynamic measure, with dynamic code, that calculates different things depending on what is selected on slicers.

    I would suggest using harvester measures. You create a separate, unconnected  table for each of the variables you want to play with, like Category, Year, and if you need it, Type of comparison (>0, =0)


    With the harvester measure you capture what's been selected and 

    [Sales1]=CALCULATE(SUM(Report1[Qty]), Report1[Category]=[Harvested Category1]; Report1[Year]=[Harvested Year1])

    [Sales2]=CALCULATE(SUM(Report1[Qty]), Report1[Category]=[Harvested Category2]; Report1[Year]=[Harvested Year2])

     

    Table= FILTER(ALL(Report1[Account]), [Sales1] > 0 && [Sales2] =0)

     

    You could follow a similar approach to select the comparison ">0", "=0", etc.