Forum Discussion

Bokchoy's avatar
Bokchoy
Icon for Helper II rankHelper II
4 years ago
Solved

look up value within temporary groupby table

Hi all,   I have a temp table that sums up total_charge, grouped by single_date. Now i want to return the date where the highest "sum all charge" was hit. im having troubles with referencing the...
  • ryan_mayu's avatar
    ryan_mayu
    4 years ago

    Bokchoy 

    is this what you want?

    maxdate = 
    VAR tbl=SUMMARIZE(sample_jobs,sample_jobs[job_date],"charge",sum(sample_jobs[total_charge]))
    VAR _max= maxx(tbl,[charge])
    return maxx(FILTER(tbl,[charge]=_max),'sample_jobs'[job_date])
    
    month = FORMAT([maxdate],"mmm")