Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
ToKo
Frequent Visitor

Cumulative line values for chart

Hello,

 

I would like to build cumulative line value for  below chart.

2019-12-13_11-11-42.png

 

I have plan for all month for example its 2400min in December I have 18 working days so 2400/18 = 133,33 daily.

I would like to build line that show me cumulative at the next days so 1 day will be 133,33 2 day will be 266,66 etc.

How can I do this ? 🙂 

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

HI @ToKo ,

Did your table contain the original amount field? I'd like to suggest you use the following measure formula with original amount fields:

Measure = 
VAR currDate =
    MAX ( 'Table'[Date] )
VAR dateRange =
    CALCULATETABLE (
        VALUES ( 'Table'[Date] ),
        FILTER (
            ALLSELECTED ( 'Table' ),
            YEAR ( [Date] ) = YEAR ( currDate )
                && MONTH ( [Date] ) = MONTH ( currDate )
        )
    )
VAR total =
    CALCULATE (
        SUM ( 'Table'[Amount] ),
        FILTER (
            ALLSELECTED ( 'Table' ),
            YEAR ( [Date] ) = YEAR ( currDate )
                && MONTH ( [Date] ) = MONTH ( currDate )
        )
    )
VAR duration =
    DATEDIFF ( MINX ( dateRange, [Date] ), MAXX ( dateRange, [Date] ), DAY )
RETURN
    total / duration 
        * DATEDIFF ( MINX ( dateRange, [Date] ), currDate, DAY )

Regards,

Xiaoxin Sheng

View solution in original post

3 REPLIES 3
ToKo
Frequent Visitor

@parry2k  I have one table with cumulative sum for each line and AvrageForLine for this i would like to build cumulative avrage line for chart.

 

Line DateCumulativeSumAvrageForLine
11112019-12-013428
11122019-12-015044
11132019-12-017065
11112019-12-025028
11122019-12-028044
11132019-12-0210065
11112019-12-038028
11122019-12-0312044
11132019-12-0315065
11112019-12-0411028
11122019-12-0416044
11132019-12-0419065
Anonymous
Not applicable

HI @ToKo ,

Did your table contain the original amount field? I'd like to suggest you use the following measure formula with original amount fields:

Measure = 
VAR currDate =
    MAX ( 'Table'[Date] )
VAR dateRange =
    CALCULATETABLE (
        VALUES ( 'Table'[Date] ),
        FILTER (
            ALLSELECTED ( 'Table' ),
            YEAR ( [Date] ) = YEAR ( currDate )
                && MONTH ( [Date] ) = MONTH ( currDate )
        )
    )
VAR total =
    CALCULATE (
        SUM ( 'Table'[Amount] ),
        FILTER (
            ALLSELECTED ( 'Table' ),
            YEAR ( [Date] ) = YEAR ( currDate )
                && MONTH ( [Date] ) = MONTH ( currDate )
        )
    )
VAR duration =
    DATEDIFF ( MINX ( dateRange, [Date] ), MAXX ( dateRange, [Date] ), DAY )
RETURN
    total / duration 
        * DATEDIFF ( MINX ( dateRange, [Date] ), currDate, DAY )

Regards,

Xiaoxin Sheng

parry2k
Super User
Super User

@ToKo there are many ways to achieve this, it is important to know how your data looks like to provide the appropriate solution. Can you share sample data here? 



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.