Forum Discussion

adamlang's avatar
adamlang
Helper III
1 year ago
Solved

Plotting multiple cumulative totals from different years on the same graph

Hello,

 

I have three measures that that plot the cumulative income raised during and Financial year. They will plot well on a graph that contains a filter for the respective finacial year. However, I want to merge the three graphs into one containing the multiple lines, and I can't seem to get the DAX to remove the date filters in the correct way to make this work, keeping a filter on the month.

 

The three cumulative income income measures are in the following format:

Total Income Raised (Cumulative) during 2023/24 =
VAR MaxDate = MAX('Calendar'[Date])
VAR Result =
    CALCULATE(
        [Total Value Secured],
        'Calendar'[Date] <= MaxDate,
        ALL('Calendar'),
        'Calendar'[BBBC Financial Year] = "2023/24"
    )
RETURN
Result
 
Where [Total Value Secured] =
Total Value Secured =
    CALCULATE(SUM(Table2[BBBC Income (All Years) ]), Table2[Final Application Submitted] = "Secured" || Table2[Final Application Submitted] = "Project Closed" || Table2[Final Application Submitted] = "Closed with extension", USERELATIONSHIP(Table2[Decision Date (Expected moving to Actual Date)], 'Calendar'[Date]))
 
The three indiviual graphs look like:
 

 

But when I try to plot them on a single graph without the Finacial Year Filters I get something like:

 

 

I suspect I need to tweak the use of the ALL filter in the measures so that the lines still plot correctly against the month, cumulativly. I can't seem to work this out. Maybe using Keepfilters on the month column?

 

Greatful if someone could point me in the right direction.

 

Ideally the line for the current year would stop at the current month rather than projecting forward to the end of the year as in the pink line above.

 

Many thanks,


Adam

 

12 Replies

  • Yes, you need to eliminate the year part from the measure and move it to the legend as its own materialized measure.

     

    Please provide sample data that covers your issue or question completely, in a usable format (not as a screenshot).

    Do not include sensitive information. Do not include anything that is unrelated to the issue or question.

    Need help uploading data? https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-Forum/ba-p/963216


    • adamlang's avatar
      adamlang
      Helper III

      Hi lbendlin,

       

      Thanks for engaging with this. 

       

      The data model for this is quite simple. I have a single data table in excel - called Table 2 and I've added a fairly standard calendar table in power BI which does the financial year grouping.

       

      Dummy data for table 2 cut down for just this query would look something like:

       

      DateAmount (£)
      01/01/2022100
      01/02/2022200
      01/03/2022100
      01/12/2022300
      01/01/2023500
      01/04/2023100
      01/08/2023250
      01/09/2023300
      01/12/2023400
      01/01/2024500
      01/02/2024500
      01/05/20241000
      01/07/2024400
      01/09/2024850
      01/12/2024900