Forum Discussion

Syndicate_Admin's avatar
Syndicate_Admin
Administrator
5 years ago

Cumulative sums

I have a query on how I can make a cumulative sum of a column appear to me only when the days of the month are muetted. I don't want him to show up when the years are, not the quarters, not the months, just the days.

Thank you!

3 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Syndicate_Admin ,

     

    You need to create a Calendar table to know whether the days of each month are missed.

    Based on my sample, 1/1-1/5 are missed in January but February is integral, so the sum of January is needed.

     

    If this is your requirement, please try the following formula:

     

    Measure =
    VAR _count =
        CALCULATE (
            COUNT ( 'Table'[Date] ),
            ALLEXCEPT ( 'Table', 'Table'[Date].[Year], 'Table'[Date].[Month] )
        )
    VAR _allcount =
        CALCULATE (
            COUNT ( 'calendar'[Date] ),
            FILTER (
                'calendar',
                'calendar'[Date].[Year] = YEAR ( MAX ( 'Table'[Date] ) )
                    && 'calendar'[Date].[MonthNo] = MONTH ( MAX ( 'Table'[Date] ) )
            )
        )
    RETURN
        IF (
            _count < _allcount,
            CALCULATE (
                SUM ( 'Table'[Value] ),
                ALLEXCEPT ( 'Table', 'Table'[Date].[Year], 'Table'[Date].[Month] )
            ),
            BLANK ()
        )

     

     

    Here is the pbix file.

     

    If you are still confused about it, please provide me with more details about your table and your problem or share me with your pbix file from your Onedrive for Business after removing sensitive data.

     

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

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Syndicate_Admin ,

     

    Could you tell me if your problem has been solved? If it is, kindly Accept it as the solution. More people will benefit from it.

     

    Best Regards,
    Eyelyn Qin