Forum Discussion

LeaRupnik's avatar
LeaRupnik
Helper III
6 years ago
Solved

sum column

Hello, 

a have a problem, how to sum the sum column. 

i have a exemple, a wont a sum column sum witch is sum jan in feb  and a get 1+2 = 3 then 3+3 = 6 then 6+4 = 10,....

 

datenumbersum 
jan11 
feb23 
mare36 
apr410 
maj515 
jun621 
jul728 
avg836 
sep945 
 45  

 

Please heal me. 

LEa

  • Icey's avatar
    Icey
    6 years ago

    Hi LeaRupnik ,

    Try this:

    1. Create a Calendar table.

    Calendar = CALENDAR ( DATE ( 2019, 1, 1 ), DATE ( 2019, 12, 31 ) )

    2. Create columns in Calendar table.

    Month = MONTH('Calendar'[Date])
    Month Name = FORMAT('Calendar'[Date],"mmm")

    3. Create relationship.

    4. Create measures.

    MTD = TOTALMTD(SUM('Table'[quantiti]),'Calendar'[Date])
    YTD =
    IF (
        NOT ( ISBLANK ( MAX ( 'Table'[quantiti] ) ) ),
        TOTALYTD ( SUM ( 'Table'[quantiti] ), 'Calendar'[Date] )
    )

    PBIX file attached.

     

    Best Regards,

    Icey

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

12 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Because there is no logical way to sort just the names of each month, this isn't possible. But add a date or the monthnumber (1-12) to your table and it is possible.

     

    If you have the possibility to add a column with the number of each month or a column with a date you can use:

     

     
     
    CalculatedTable = CALCULATE(SUM('Table'[values]);FILTER('Table';'Table'[monthnr]<=EARLIER('Table'[monthnr])))
    • LeaRupnik's avatar
      LeaRupnik
      Helper III

      Hello, 

       

      this is work, but i have a table more complicated. 

      I have quantity according to date, then i have to sum a quantity to month, then to each month together. 

      ia have that kind of problem

      datequantiti 
      1.02.20192 
      12.02.20195 
      14.02.20195 
      3.03.20194 
      5.03.20196 
      5.04.20192 
      6.04.20195

       

       

      and i would like to get this

      feb1212
      mar1022
      apr729
       29 

       

      thx Lea

      • Icey's avatar
        Icey
        Community Support

        Hi LeaRupnik ,

        Try this:

        1. Create a Calendar table.

        Calendar = CALENDAR ( DATE ( 2019, 1, 1 ), DATE ( 2019, 12, 31 ) )

        2. Create columns in Calendar table.

        Month = MONTH('Calendar'[Date])
        Month Name = FORMAT('Calendar'[Date],"mmm")

        3. Create relationship.

        4. Create measures.

        MTD = TOTALMTD(SUM('Table'[quantiti]),'Calendar'[Date])
        YTD =
        IF (
            NOT ( ISBLANK ( MAX ( 'Table'[quantiti] ) ) ),
            TOTALYTD ( SUM ( 'Table'[quantiti] ), 'Calendar'[Date] )
        )

        PBIX file attached.

         

        Best Regards,

        Icey

         

        If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

  • Icey's avatar
    Icey
    Community Support

    Hi LeaRupnik ,

    If you have no other questions, please accept the previously useful response as a answer.

     

    Best Regards,

    Icey