Oracle Analytics Cloud and Server

Welcome to the Oracle Analytics Community: Please complete your User Profile and upload your Profile Picture

Create a Logical Column to Sum one column for distinct values in another column

Received Response
816
Views
27
Comments
13»

Answers

  • user11079646
    user11079646 Rank 3 - Community Apprentice

    No, I need enrolled summed for every row and capacity summed only for unique classes.

    If I were to query ALL of the data (no filters), grouped by Term/Dept, I would want to see something like this:

    Term_IDDeptEnrolledCapacity
    1176ART030
    1179ART460
    1179BIOL040

    If I were to remove Dept, to just see the numbers at the term level, I would want to see:

    Term_ID
    EnrolledCapacity
    1176030
    11794100

    So, I can get the enrolled count easy - its a simple measure that just sums.

    Capacity cannot have a simple sum on it since the value is repeated when > 1 person is enrolled in a class.

  • Thomas Dodds
    Thomas Dodds Rank 8 - Analytics Strategist

    make a logical fact out of dim_sections

    you care trying to make 'capacity' a measure and you've got it in your dimension (it's both so you need both structures)

    you have 2 facts and one dimension.

  • asim cholas
    asim cholas Rank 6 - Analytics Lead

    Not a simple sum

    sum(capacity by 1sttableterm_id,1sttableclass_id)

  • Thomas Dodds
    Thomas Dodds Rank 8 - Analytics Strategist

    capacity is an 'inventory measure' and currently is an attribute in his dimension ... he's got to get it to a fact table first ...

  • user11079646
    user11079646 Rank 3 - Community Apprentice

    Asim,by

    That is exactly the formula I want - but OBIEE won't let me put that syntax in the expression for a logical column.  I get the following error:

    "[nQSError: 27002] Near <by>: Syntax error [nQSError: 26012] ."

    Thomas,

    I created a new logical table called "fact_sections" and added in the logical columns for the key and the "capacity", my measure.   Initial reports are looking like it is aggregating correctly.  I will finish up my testing and post back.

    So.... it seems like measures will naturally just aggregate at the granularity of the fact table they are in - is that true?

  • asim cholas
    asim cholas Rank 6 - Analytics Lead

    Did you try in answers?

  • Thomas Dodds
    Thomas Dodds Rank 8 - Analytics Strategist

    Welcome to dimensional modeling ... facts (measures) are what is aggregated BY dimensions (attributes)

    Sales (aggregated fact) by employee (dimensional attribute) by month (dimensional attribute)

    You set the aggregation rule (default is usually SUM) ... but in the case of an inventory, where you can not add across time, the aggregation rules needs to be set at LAST (most recent count).