Forum Discussion

meganm1996's avatar
meganm1996
New Member
2 years ago
Solved

Help With Cumulative Line Chart Showing Year Over Year Sales Growth

Hoping to get some help with an issue I'm running into trying to create a cumulative line chart for a sales report I'm working on. I'm trying to create a cumulative line chart to compare year over ye...
  • AlexisOlson's avatar
    AlexisOlson
    2 years ago

    OK, now that's a measure problem. You need a YTD cumulative measure.

     

    The shortest solution is probably

    TOTALYTD (  SUM ( 'deal list'[Deal - Value] ), 'DateTable'[Date] )

    but I'm not a fan of built-in time-intelligence functions.

     

    There are lots of ways of writing a TOTALYTD without time-intelligence. For example, a pattern like this one here:

    Month-related calculations – DAX Patterns

    Or you can use the newer WINDOW function and write something like this:

    Amount YTD =
    CALCULATE (
        SUM ( 'deal list'[Deal - Value] ),
        WINDOW (
            1, ABS,
            0, REL,
            ORDERBY ( 'DateTable'[Date], ASC ),
            PARTITIONBY ( 'DateTable'[Year] )
        )
    )