OLAP Grid: values are not summed

Posted by: abellisomi on 17 March 2020, 2:43 am EST

  • Posted 17 March 2020, 2:43 am EST

    Hello,
    I am loading some values in a OLAP grid using a DataSet - each DataRow contains decimal values.
    When I try to do an aggregation the SUM does not seem to work as I only can do a COUNT subtotal.
    I even tried to force the formatting this way

    var olap = OlapPage.OlapPanel.OlapEngine;
    // bind OLAP page to data
    olap.DataSource = ds.Tables[0].DefaultView;

    // apply update to view
    olap.BeginUpdate();
    olap.ColumnFields.Add("BusinessUnitId");
    olap.FilterFields.Add("RiskId");
    olap.RowFields.Add("Year");

    olap.ValueFields.Add("Loss");
    olap.Fields["Loss"].Format = "n0";
    olap.Fields["Loss"].Subtotal = Subtotal.Sum;

    olap.EndUpdate();


    The grid only shows a bunch of zeroes.
    What am I missing?
    Thank you
  • Replied 17 March 2020, 7:42 pm EST

    Hi,

    I reviewed the code and even tested with an application, the Olap defined using the code seems to work just fine for me.
    I have used the 2019v3 C1 version, what version are you currently using?

    Regards,
    Ruchir

    SumOlap_WPFC1.zip
  • Replied 17 March 2020, 9:36 pm EST

    Hello and thanks for the quick reply.
    The version I am using is 4.0.20173.580
    Maybe the issue is in the way I generate the data? I will try to send you an example.
  • Replied 18 March 2020, 6:11 pm EST

    Hi,

    I changed the Olap's datasource to use an ObservableCollection and it still functioned well. Also, I tested the application with the same version as yours (*.20173.580) and still could not observe an issue with Olap.

    While you try to prepare an example, could you try to skip defining the FilterFields collection and see, whether it causes a change in output?

    Thanks,
    Ruchir
  • Replied 18 March 2020, 10:17 pm EST

    Can maybe the issue be the fact that I didn't declare the type of the DataColumns?

    In you example you have, before loading the DataTable:


    dt.Columns.Add("Name", typeof(string));
    dt.Columns.Add("Quarter", typeof(string));
    dt.Columns.Add("Sales", typeof(decimal));


    I can imagine the component, missing this declarations, does not know how to handle the data.
  • Marked as Answer

    Replied 19 March 2020, 5:14 am EST

    I confirm that was the issue. I had to declare the type of each column.
    Thanks for assistance
  • Replied 19 March 2020, 2:51 pm EST

    Glad that you were able to trace the source of the issue and resolve it.
    Should you need any assistance any further, do let me know.

    ~Ruchir
Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels