We have updated Flexmonster Software License Agreement, effective as of September 30, 2024. Learn more about what’s changed.

Cannot compute average

Resolved
Alberto Nudman asked on June 7, 2017

Hi
I have some measures in my pivot table, and when clicking on the small "Sigma" on the right of the measure's name, I can choose between several types of aggregations: Sum, Count, Average, etc.
However, when I add another column to the box (Delay_in_days), its name is displayed, but the "Sigma" will only show "Count" and "DistinctCount", and I need to compute an average on that column. The only difference I see is that the new column has zeroes in it.
Of course, I need those zeroes to be computed into the average calculation, because a delay of zero days lowers the average
Thanks

3 answers

Public
Iryna Kulchytska Iryna Kulchytska Flexmonster June 8, 2017

Hi Alberto,
 
Thank you for your question.
 
Only “Count” and “DistinctCount” aggregations are available for columns that contain string data. If your Delay_in_days column contains numeric data you can set its type for the component explicitly in CSV or JSON. More details on how to define the data type explicitly can be found in the articles Data types in CSV and Data types in JSON respectively.
 
For example, in CSV you need to add prefix '-' to the column name in the header row of CSV, as follows:

Column1,-Delay_in_days,Column3
1,0,name1
2,14,name2

Please let me know if setting the data type explicitly works for you.
 
Kind regards,
Iryna

Public
Alberto Nudman June 8, 2017

Dear Iryna,
My data is loaded in SQL Server. Therefore, making the source table define the data type as INT  (i.e, SELECT CAST(number_of_days AS INT) AS number_of_days, did the trick
Id there a way to limit the number of decimals shown in the table?
Many thanks!

Public
Alberto Nudman June 8, 2017

Hello,
I managed to limit the number of decimals in the average with

             formats: [{
                name: "TwoDecimals",
                decimalPlaces: 2
            }],
And then...
{ uniqueName: "[dias_primer_contacto]", "aggregation": "average", "format": "TwoDecimals"}
Thanks for helping me out of this. Flexmonster is just too cool.

Please login or Register to Submit Answer