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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
AlvinLy
Helper II
Helper II

Measure is bringing in values outside of report visual's Filter

Hello,

 

Ok i'm going to have a new attempt at this question with more information for the community to use to help me decipher this issue.

Currently I am trying to create a measure that will indicate the period end date associated to a schedule date for every single activity. I have created two versions of this measure:

 

Version 1:

 

Sch End Period Measure 1 = 
VAR enddate = MAX(Activity_F[Schedule Date])
RETURN
CALCULATE(
    MIN(Date_D[Period End Date]),
    Filter(ALL(Date_D), Date_D[Period End Date] > enddate)
)

 

 

Version 2:

 

Sch End Period Measure 2 = 
VAR enddate = MIN(Activity_F[Schedule Date])
VAR FilteredCalendar = Filter(ADDCOLUMNS(Date_D, "Friday", Date_D[Period End Date]), [Friday] > enddate)
RETURN
MINX(FilteredCalendar, [Friday])

 

 

The problem comes when I am filtering the data, in this example, the page is filtered to project 1 this is what I get when the measures are NOT included:

AlvinLy_0-1715358669920.png

 

When I include either measures, the results for both my measures are the same and is as such:

AlvinLy_1-1715358709285.png

The key thing to note is Activity 1485 is not even in project 1 

 

So the question is why is my measure bringing in values outside of the visual's filter?

See link to sample dataset: 

https://docs.google.com/spreadsheets/d/16p14vzSTxTnaxLCwpmWr-MSLGXxyglTd/edit?usp=drivesdk&ouid=1038...

2 REPLIES 2
Anonymous
Not applicable

Hi @AlvinLy ,

 

1. I think this is due to the table to table relationship, you can modify the relationship.

vkaiyuemsft_0-1715591886247.png

 

2.Create measure.

Measure = 
VAR _seleted =
    SELECTEDVALUE ( Project_D[Project] )
VAR _projectID =
    MAXX (
        FILTER ( 'Project_D', 'Project_D'[Project] = _seleted ),
        'Project_D'[ID]
    )
VAR _table =
    CALCULATETABLE (
        SUMMARIZE (
            FILTER ( ALLSELECTED ( 'Activity_F' ), 'Activity_F'[Project ID] = _projectID ),
            Activity_F[Activity ID],
            'Activity_F'[Activity Step],
            Activity_F[Schedule Date],
            "maxday", MAX ( 'Activity_F'[Schedule Date] )
        )
    )
VAR _table2 =
    ADDCOLUMNS (
        _table,
        "day",
            CALCULATE (
                MIN ( 'Date_D'[Period End Date] ),
                FILTER ( 'Date_D', 'Date_D'[Period End Date] > [maxday] )
            )
    )
VAR _activityID =
    SELECTEDVALUE ( Activity_F[Activity ID] )
// VAR enddate =
//     MAXX ( _table, 'Activity_F'[Schedule Date] )
RETURN
    MAXX ( FILTER ( _table2, 'Activity_F'[Activity ID] = _activityID ), [day] )

 

vkaiyuemsft_1-1715591931440.png

If your Current Period does not refer to this, please clarify in a follow-up reply.

 

Best Regards,

Clara Gong

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

Hi Clara,

Thank you for looking at my post.
1. Yes i have my table relationships setup in the way you've shown above. 
2. Although I understand the direction of the code, and it is helpful to get this example; I'm not sure this is a robust solution for me. The example I provided is a sample of my actual data which has many more parameters that I need to filter from. Project ID was one of the many parameters. I think your code focuses specifically on project ID and building a "new" table (_table) from project ID. I have about 5 other filters that I would need to use in my actual data and the report visualizations. Would I need to go through and include each one as a filter in the measure?

3. I don't think i provided a good example of what i wanted to see which is the periond end date for each activity step. This snap shot is what I would like to see, but with the projects being filtered to one specific project or in my actual data any other filters I want to employ

AlvinLy_0-1715609437919.png

I guess i'm trying to look for a solution, where if i were to filter by any related dimension in a connected dimension table (since my actual data is a much larger model), without having to explicitly note each dimension in the measure. Hoping to see a more robust code that won't need manual intervention each time

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 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