Quantcast
Channel: Pentaho Community Forums
Viewing all articles
Browse latest Browse all 16689

aggregate functions fail on calculated fields

$
0
0
hi pentaho users, i am new to pentaho bi solution and i came upon a problem when using the query editor and querying aggregated calculated fields

i am using pentaho metadata editor's latest stable version 4.8.0

here are the sql and mql codes generated by pentaho for this setup
aggregates.jpg
Code:

SELECT
          BT_DIMSITES_DIMSITES.designation AS COL0
        ,((nombre_present / nombre_total) * 100) AS COL1
FROM
          dimsites BT_DIMSITES_DIMSITES
        ,factpresence BT_FACTPRESENCE_FACTPRESENCE
WHERE
          ( BT_DIMSITES_DIMSITES.cle_site = BT_FACTPRESENCE_FACTPRESENCE.cle_site_p )
GROUP BY
          BT_DIMSITES_DIMSITES.designation

Code:

<mql>
  <domain_type>relational</domain_type>
  <domain_id>sodexodwbi</domain_id>
  <model_id>Presence</model_id>
  <model_name>Statistique presence</model_name>
  <options>
    <disable_distinct>false</disable_distinct>
    <limit>-1</limit>
  </options>
  <selections>
    <selection>
      <view>Sites</view>
      <column>BC_DIMSITES_DESIGNATION</column>
      <aggregation>none</aggregation>
    </selection>
    <selection>
      <view>fait_presence</view>
      <column>BC_FACTPRESENCE_RAPPORT</column>
      <aggregation>average</aggregation>
    </selection>
  </selections>
  <constraints/>
  <orders/>
</mql>

on the generated sql code, there is no aggregate function applied to the calculated field

Quote:

((nombre_present / nombre_total) * 100)
if its not a calculated field the aggregate function are well applied.

"is the formula exact" is on true because if i dont i get this error

Code:

An error occurred executing SQL:
SELECT
          BT_DIMSITES_DIMSITES.designation AS COL0
        ,AVG(BT_FACTPRESENCE_FACTPRESENCE.`((nombre_present / nombre_total) * 100)`) AS COL1
FROM
          dimsites BT_DIMSITES_DIMSITES
        ,factpresence BT_FACTPRESENCE_FACTPRESENCE
WHERE
          ( BT_DIMSITES_DIMSITES.cle_site = BT_FACTPRESENCE_FACTPRESENCE.cle_site_p )
GROUP BY
          BT_DIMSITES_DIMSITES.designation


Unknown column 'BT_FACTPRESENCE_FACTPRESENCE.((nombre_present / nombre_total) * 100)' in 'field list'

what am i doing wrong here, thanks for your help
Attached Images

Viewing all articles
Browse latest Browse all 16689

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>