Dynamic Columns Brick - Aggregation Question

Hey everyone! I'm trying to use the Dynamic Columns Brick:

I know nothing about Javascript. It seems for all the different Metrics that you can select, the "Default" aggregation is SUM( ). Is it possible to change that somewhere in the Javascript (or elsewhere) a different aggregation like AVG( ) or MIN( )?

I can somewhat read code, but i could not find where in the code the "Default" was set to SUM( ) for the Metrics Columns. Appreciate any insight or help!!!

Tagged:

Answers

  • Hi, I'm new to DDX (started learning this morning) but it seems you can indicate the aggregation you want to use as part of the query. Here they talk about it in detail https://developer.domo.com/portal/ec60c4980e1b5-getting-started-using-domo-bricks#get-the-data . But basically if you're using the Query notation, after adding your fields and group by, you can add each agregtion followed by the name of the field,like I've highlighted in bold below.

    const query = `/data/v1/sales?fields=${select.join()}
      &filter=${where.join()}
      &groupby=${groupby.join()}
      &sum=amount
      &calendar=fiscal
    `;
    

    Hope this helps.