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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
edesroch
New Member

Filter Cumulative Expenditure by a measure in a slicer

Hi All,

 

I am trying to control the display of the Cumulative Expenditure of the table and the graph below according to the slicer selection.

 

edesroch_1-1708439544291.png

 

When I make a single selection, the display works properly but when I make several selections nothing is displayed.

 

edesroch_2-1708439571763.png

 

I have three tables that are related by "Date"

 

edesroch_0-1708439465309.png

 

I have 4 measures which calculate Cumulative Expenditure for each Financial Year and one measure which calculates Forecast Expenditure for FY 23-24.

 

Measure to calculate Cumulative Expenditure for FY 23-24 goes like this :

 

23-24 **bleep** Expenditure =
CALCULATE (
    SUMX (
        SUMMARIZE (
            Calendar_Table,
            Calendar_Table[Date],
            "CumulativeExpenditure",
                CALCULATE (
                    IF (
                        CONTAINS ( Calendar_Table, Calendar_Table[ID], 23 ),
                        SUM ( Expenditure_Table[Amount] ),
                        BLANK ()
                    )
                )
        ),
        [CumulativeExpenditure]
    ),
    FILTER (
        ALL( Calendar_Table ),
        Calendar_Table[Date] <= MAX ( Calendar_Table[Date] )
        && Calendar_Table[ID] = SELECTEDVALUE( Calendar_Table[ID] )
    )
)

 

Does anyone have any idea how I could solve my problem to be able to simultaneously display Cumulative Expenditure for multiple Fiscal Year ?

 

Regards

2 REPLIES 2
vicky_
Super User
Super User

the issue is that you have SELECTEDVALUECalendar_Table[ID] ) which i assume has 2+ values when you select two different financial years like in the screenshot. Unfortunately, SELECTEDVALUE returns blank if there isn't 1 distinct value. To fix it, consider changing that last condition to something like:

 Calendar_Table[ID] in VALUES( Calendar_Table[ID] )

 

Thank you for your answer. This is moving in the right direction. Now I can display multiple Fiscal Year simultaneously on tha matrix but only the most recent FY selected is showing Cumulative Expenditure while I am getting repeatitive values for the other FY.

 

edesroch_1-1708530675390.png

 

Here is the code after changing the last condition :

 

23-24 **bleep** Expenditure =
CALCULATE (
    SUMX (
        SUMMARIZE (
            Calendar_Table,
            Calendar_Table[Date],
            "CumulativeExpenditure",
                CALCULATE (
                    IF (
                        CONTAINS ( Calendar_Table, Calendar_Table[ID], 23 ),
                        SUM ( Expenditure_Table[Amount] ),
                        BLANK ()
                    )
                )
        ),
        [CumulativeExpenditure]
    ),
    FILTER (
        ALL( Calendar_Table ),
        Calendar_Table[Date] <= MAX ( Calendar_Table[Date] )
        && Calendar_Table[ID] in VALUES( Calendar_Table[ID] )
    )
)
 
Regards

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.