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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
malikara46
Frequent Visitor

Show line chart with cumulative values

Hi everyone, 

my task was to show 2 lines in a line chart where one line is for actual and other is for plan costs per Periode. Now the customer is asking to create another graph where the same comparison happens using cumulative values.

 

My table of costs has the following structure where each row is a function/person that is booking costs in a certain periode. Per each Periode (P01-12) there is an actual and a plan value per function. 

 

FunctionP01 ActualP01 PlanP02 ActualP02 Plan
Bid Director500 €300 €400 €400 €
QA200200350300

 

For, the indivual values, I had created a new table where I categorized the costs based on actual and plan cost. 

UNION(
    SELECTCOLUMNS(
        'Costs',
        "Periode", "P01",
        "Cost Type", "Actual Cost",
        "Cost", 'Costs'[P01 Actual], 'Cost'[Function]
    ),
    SELECTCOLUMNS(
        'Costs',
        "Periode", "P01",
        "Cost Type", "Plan Cost",
        "Cost", 'Costs'[P01 Plan], 'Cost'[Function]
    ),
So the result table structure was something like this: 
PeriodeCost TypeCost Function
P01Actual Cost500 €Bid Director
P01Plan Cost300 €Bid Drector
 
I am aiming to create a new table with cumulative values, but I haven't had any success so far. One challenge I faced with the individual cost was sorting the table starting at Periode 11 continuing at Periode 12, 01, etc. I managed to solve this by creating an additional table with the sorting logic and establishing a relationship to the result table adding the sorting order from that additional table. So again, I would aim for a similar solution. However, I am struggling with the cumulative sum, as it needs to start at P11, but it somehow starts at P01 or in other results do not cumulate at all but instead just takes the indivual value. 
 
 
1 ACCEPTED SOLUTION

may want to check your math on the Requirements manager.

lbendlin_2-1741725431205.png

 

 

lbendlin_1-1741725408715.png

 

 

View solution in original post

6 REPLIES 6
malikara46
Frequent Visitor

I created a running total on the table where I had pivoted the table (see above at the second table (not the raw one)). Let this be called Off-PeriodsTable

RunningTotal = 
CALCULATE(
    SUMX(
        FILTER(
            ALL('Off-PeriodsTable'),
            'Off-PeriodsTable'[Function] = MAX('Off-PeriodsTable'[Function]) &&
            'Off-PeriodsTable'[SortOrder] <= MAX('Off-PeriodsTable'[SortOrder]) &&
            'Off-PeriodsTable'[Cost Type] = MAX('Off-PeriodsTable'[Cost Type])
        ),
        'Off-PeriodsTable'[Cost]
    )
)

 

This works partially. When I filter for a function e.g. Bid director the values are correct. But the default stage of the line chart when no filter is selected it shows a wrong total/number. Also when I add the attributes to a table for testing purposes, the Total at the very end is either 0 or way less then expected.

may want to check your math on the Requirements manager.

lbendlin_2-1741725431205.png

 

 

lbendlin_1-1741725408715.png

 

 

malikara46
Frequent Visitor

Thank you. I tried to upload a sample excel file where expected graphs are also included but this is not supported. So anyway in following the sample data: 

Cost table

FunctionTotal Actual CostTotal Plan CostP11 - Actual Cost P11 - Plan CostP12 - Actual Cost P12 - Plan CostP01 - Actual Cost P01 - Plan CostP02 - Actual Cost P02 - Plan CostP03 - Actual Cost P03 - Plan Cost
Bid Director1.200 €1.600 €500 €500 €400 €200 €300 €200 € 300 € 400 €
Requirements Manager2.400 €2.100 €700 €300 €800 €500 €900 €700 € 0 € 600 €
Technical Expert900 €2.700 €400 €600 €500 €800 €0 €400 € 500 € 400 €

 

After applying code on cost table: 

PeriodeCost TypeCostFunctionSort Order
P11Actual Cost500 €Bid Director1
P11Plan Cost500 €Bid Director1
P11Actual Cost700 €Requirements Manager1
P11Plan Cost300 €Requirements Manager1
P11Actual Cost400 €Technical Expert1
P11Plan Cost600 €Technical Expert1
P12Actual Cost400 €Bid Director2
P12Plan Cost200 €Bid Director2
P12Actual Cost800 €Requirements Manager2
P12Plan Cost500 €Requirements Manager2
P12Actual Cost500 €Technical Expert2
P12Plan Cost800 €Technical Expert2
P01Actual Cost300 €Bid Director3
P01Plan Cost200 €Bid Director3
P01Actual Cost900 €Requirements Manager3
P01Plan Cost700 €Requirements Manager3
P01Actual Cost0 €Technical Expert3
P01Plan Cost400 €Technical Expert3
P02Actual Cost Bid Director4
P02Plan Cost300 €Bid Director4
P02Actual Cost Requirements Manager4
P02Plan Cost0 €Requirements Manager4
P02Actual Cost Technical Expert4
P02Plan Cost500 €Technical Expert4
P03Actual Cost Bid Director5
P03Plan Cost400 €Bid Director5
P03Actual Cost Requirements Manager5
P03Plan Cost600 €Requirements Manager5
P03Actual Cost Technical Expert5
P03Plan Cost400 €Technical Expert5

 

This is the expected table with cumulative values

 

Expected Table with cumulative values

PeriodeCost TypeCostFunctionSort Order
P11Actual Cost500 €Bid Director1
P11Plan Cost500 €Bid Director1
P11Actual Cost700 €Requirements Manager1
P11Plan Cost300 €Requirements Manager1
P11Actual Cost400 €Technical Expert1
P11Plan Cost600 €Technical Expert1
P12Actual Cost900 €Bid Director2
P12Plan Cost700 €Bid Director2
P12Actual Cost1.500 €Requirements Manager2
P12Plan Cost800 €Requirements Manager2
P12Actual Cost900 €Technical Expert2
P12Plan Cost1.400 €Technical Expert2
P01Actual Cost1.200 €Bid Director3
P01Plan Cost900 €Bid Director3
P01Actual Cost2.400 €Requirements Manager3
P01Plan Cost1.500 €Requirements Manager3
P01Actual Cost900 €Technical Expert3
P01Plan Cost1.800 €Technical Expert3
P02Actual Cost1.200 €Bid Director4
P02Plan Cost1.200 €Bid Director4
P02Actual Cost2.400 €Requirements Manager4
P02Plan Cost1.500 €Requirements Manager4
P02Actual Cost900 €Technical Expert4
P02Plan Cost2.300 €Technical Expert4
P03Actual Cost1.200 €Bid Director5
P03Plan Cost1.600 €Bid Director5
P03Actual Cost2.400 €Requirements Manager5
P03Plan Cost1.560 €Requirements Manager5
P03Actual Cost900 €Technical Expert5
P03Plan Cost2.700 €Technical Expert5

 

lbendlin
Super User
Super User

Please provide sample data that fully covers your issue.
Please show the expected outcome based on the sample data you provided.

Dear Ibendlin, 

not sure why my response is not shown below your message, but as requested please see the sample data in my other response. 

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors