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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
Sixian
Frequent Visitor

Cumulative double line chart operating on dates

Hi,

I have a table with a list of items with a "target date" and an "actual date" (or blank) associated.

As you can see from the attached image, I use a slicer to filter the visuals by the year of the target dates. This way I get a chart with a bar showing the total number of items (a COUNT) with a target date in the selected year and a bar showing the total number of items with an actual date in the selected year. The second chart shows the same information, but drilled to each single month of the year.

 

 ScreenShot 001.png

 

I need to add a double line chart showing the same values of the second chart (the monthly chart), but with cumulative values (COUNT). So, for instance, the February "target date" value will be the count of all the items with a target date included in both January and February and so on.

 

I couldn't find a working solution by looking to other posts, so I ask for your help.

 

Thank you.

1 ACCEPTED SOLUTION

Hi @Sixian,

 

Based on the @Anonymous's solution, you can try this one.

 

Items running total =
CALCULATE (
    COUNT ( 'Table'[Item] ),
    FILTER (
        ALLSELECTED ( 'Table'[MonthNumber] ),
        ISONORAFTER ( 'Table'[MonthNumber], MAX ( 'Table'[MonthNumber] ), DESC )
    )
)

I would suggest you create a date table if you don't have one.

 

 

Measure =
CALCULATE (
    COUNT ( 'table'[item] ),
    FILTER (
        ALLSELECTED ( 'datetable' ),
        'datetable'[date] <= MAX ( 'datetable'[date] )
    )
)

Or please share a sample file? Mask the sensitive parts first.

 

 

Best Regards,
Dale

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

View solution in original post

5 REPLIES 5
Sixian
Frequent Visitor

I tried to understand and apply the suggestion, but the chart shows nothing.
Any help would be greatly appreciated.

Hi @Sixian,

 

Based on the @Anonymous's solution, you can try this one.

 

Items running total =
CALCULATE (
    COUNT ( 'Table'[Item] ),
    FILTER (
        ALLSELECTED ( 'Table'[MonthNumber] ),
        ISONORAFTER ( 'Table'[MonthNumber], MAX ( 'Table'[MonthNumber] ), DESC )
    )
)

I would suggest you create a date table if you don't have one.

 

 

Measure =
CALCULATE (
    COUNT ( 'table'[item] ),
    FILTER (
        ALLSELECTED ( 'datetable' ),
        'datetable'[date] <= MAX ( 'datetable'[date] )
    )
)

Or please share a sample file? Mask the sensitive parts first.

 

 

Best Regards,
Dale

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

I'm now using the date table and following the new instructions. I'm getting close, but the numbers are still not exact. May be there is something in the filters. I'll let you know.

Thanks for now.

Anonymous
Not applicable

Have you tried creating a running total column or measure?

 

Make sure you have a column 'MonthNumber' which corresponds to the number of the month (1 for Jan, 2 for Feb etc.)

 

Items running total = 
CALCULATE(
    SUM('Table'[ItemCount]),
    FILTER(
        ALLSELECTED('Table'[MonthNumber]),
        ISONORAFTER('Table'[MonthNumber], MAX('Table'[MonthNumber]), DESC)
    )
)

Sorry.

What do you mean for 

'Table'[ItemCount]

 

We can suppose we just have a table with the three columns: |item|target date|actual date|

The 'Table' should be this table with all the items and dates, but what column is [ItemCount]?

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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