Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago
Solved

Clustered column chart with cumulative sum measure based on filters applied on chart

Dear all,   I am quite new on Power BI and have been struggling a lot to fix the below issue. I have spent hours and still cannot find a solution. Maybe is it my database that is not suitable for t...
  • Anonymous's avatar
    Anonymous
    3 years ago

    Hi Anonymous ,

     

    To create a running total for a specific financial indicator, economic scenario, and years, you can use the following DAX formula:

    CumulativeTotal = 
    CALCULATE(
        SUM(TableQuery[Value]),
        FILTER(
            ALL(TableQuery),
            TableQuery[Financial Indicator] = "NCF" &&
            TableQuery[Economic Scenario] IN {"Poor Economy", "Good Economy"} &&
            TableQuery[Date] IN {DATE(2023,1,1), DATE(2024,1,1)} &&
            TableQuery[Plant Name] = SELECTEDVALUE(TableQuery[Plant Name])
        ),
        'Calendar'[Date] <= MAX('Calendar'[Date])
    )

    This formula uses the FILTER function to apply multiple filters to the table, including the financial indicator, economic scenario, years, and plant name. The SELECTEDVALUE function is used to ensure that the plant name filter is applied correctly.

    You can then use this measure in your clustered bar chart to show the running total for the selected indicators. 

     

    Best Regards,

    Stephen Tao

     

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