Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Total by 3 categories

Hi, i have a test table:

ID Nrb CountryScenarioShare
363331AustraliaActual1.00
363331ChinaActual1.00
363331DenmarkActual1.00
363331IndonesiaActual1.00
363331IndiaActual1.00
363331JapanActual1.00
363331CanadaActual1.00
363331FinlandActual1.00
363331NorwayActual1.00
363331SingaporeActual1.00
363331GermanyActual1.00
363331SpainActual1.00
Total   1.00

I want to have a total share group by those 3 colums like 12

  • Anonymous's avatar
    Anonymous
    4 years ago

    Hi Anonymous,

    You can try to use the following measure formulas, I add a variable with summarize function to aggregate value based on categories and use the iterator function to apply these second aggregations to summary previous results.

    formula =
    VAR summary =
        SUMMARIZE (
            ALLSELECTED ( Table ),
            [ID Nrb],
            [Country],
            [Scenario],
            "_Share", [Share]
        )
    RETURN
        SUMX ( summary, [_Share] )

    Regards,

    Xiaoxin Sheng

4 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Anonymous,

    You can try to use the following measure formulas, I add a variable with summarize function to aggregate value based on categories and use the iterator function to apply these second aggregations to summary previous results.

    formula =
    VAR summary =
        SUMMARIZE (
            ALLSELECTED ( Table ),
            [ID Nrb],
            [Country],
            [Scenario],
            "_Share", [Share]
        )
    RETURN
        SUMX ( summary, [_Share] )

    Regards,

    Xiaoxin Sheng

  • Anonymous 

    is share column a measure?

    if not, when you set share as sum, you should get 12

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi, I forgett mention that Share is a measure

      • ryan_mayu's avatar
        ryan_mayu
        Icon for Super User rankSuper User

        Anonymous 

        maybe you can try this

        measure = sumx('Table',[share])