Forum Discussion

chadmkelly's avatar
chadmkelly
Regular Visitor
2 years ago
Solved

Creating a flag based on two measures

Hi, I have a measure that calculates the cost per lead, within a table by client id.  I also have a measure that shows the std deviation and mean of the cost per lead for the entire cohort I'm looki...
  • Greg_Deckler's avatar
    Greg_Deckler
    2 years ago

    chadmkelly I'm going to agree with CoreyP on this. It's likely that you are going to have to remove whatever context (filters) you have within your table visual in order to get this to work. So something like this:

    standard_deviation =
    VAR __table = SUMMARIZE(ALLSELECTED('dataset'),'dataset'[client_id],"__Measure",[cost_per_lead])
    RETURN STDEVX.P(__table,[__Measure])
    average_cpl = 
    VAR __table = SUMMARIZE(ALLSELECTED('dataset'),'dataset'[clientid],"__Measure",[cost_per_lead])
    RETURN AVERAGEX(__table,[__Measure])
    std_dev + Avg = 
    CALCULATE([average_cpl]+[standard_deviation])

    Then you *should* be able to create a complex selector like this ( you can use it in your Filters pane or adjust to return an icon (UNICHAR).

    Selector = IF( [Date Range - Cost Per Lead] > [std_dev + Avg], 1, 0 )