cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
RustyNails Helper II
Helper II

Filter Data based on a specific row value

Hello,

 

I have a table with a list of milestones for each project in a vertical manner along with the milestone date and status. I want to be able to filter to specific projects from the table based on a specific milestone status. For example, here is the source table:

 

image.png

 

In this example above, I want to count projects that only have Project Finalized = Complete. So basically, a measure that will count the Project_cd and return Project_cd = 1000 and 1003. 10001 should be skipped because it's not complete.

 

There could be various factors too. The end user could only want to look at Projects that are "Started", or both "Started and Complete". The way I want the final results to look like is a matrix that has the milestones across based on Project Finalized = Complete. That way, you can do Count(Project_Cd) against how many Projects are initialized, how many approved, assigned etc.

 

Project InitializationFunding ApprovedResources AssignedProject Finalized
2122

 

Funding Approved is only 1 because it's not completed. So far I've gotten to: calculate( count(Project_cd) , ALL(Table), Table[Milestone] = "Project Finalized") but I'm hitting a roadblock. It's just aggregating the final milestone's project count.

 

Thanks for the help!

 

6 REPLIES 6
Highlighted
Community Support
Community Support

Re: Filter Data based on a specific row value

hi, @RustyNails 

Based on my research, you could try this formula:

Result = 
CALCULATE (
    COUNTA ( 'Table'[Project_Cd] ),
    FILTER (
        'Table',
        CALCULATE (
            MAX ( 'Table'[Milestone_Status] ),
            FILTER (
                ALLEXCEPT ( 'Table', 'Table'[Project_Cd] ),
                'Table'[Milestone] = "Project Finalized"
            )
        ) = "Complete"
            && 'Table'[Milestone_Status] = "Complete"
    )
)

Or split it into two measure

Measure = CALCULATE(MAX('Table'[Milestone_Status]),FILTER(ALLEXCEPT('Table','Table'[Project_Cd]),'Table'[Milestone] = "Project Finalized"))
Measure 2 = 
CALCULATE (
    COUNTA ( 'Table'[Project_Cd] ),
    FILTER (
        'Table',
        [Measure] = "Complete"
            && 'Table'[Milestone_Status] = "Complete"
    )
)

Result:

8.JPG

 

Best Regards,

Lin

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
RustyNails Helper II
Helper II

Re: Filter Data based on a specific row value

Thank you, this gets me half way there actually! I completely forgot about a Milestone Dt slicer as well. So the user would want to see for example how many "Project Finalized" have been completed for Q1 2019. That would mean I will need to limit the query to only pull Projects that have Project Finalized between 1/1 and 3/31. All the other milestones must also be limited by not only the slicer, but their individual Project Finalized dates.  For example, I can't show 5 Project Approveds between Q1 and Q2  even though I have only 2 Project Finalizeds in Q1.  The 2 Project Approveds should be a subset of the 2 Project Finalized for Q1. Is there a way to limit this in DAX? Thanks in advance.

nmck86 Post Patron
Post Patron

Re: Filter Data based on a specific row value

CALCULATE(
COUNT('TBL'[PROJECT_CD] ),
'TBL'[PROJECT_CD] = "1000")+CALCULATE(
COUNT('TBL'[PROJECT_CD] ),
'TBL'[PROJECT_CD] = "1003")

 

may be missing a parenthesis but that should get you the counts for the codes that are equal to 1001 & 1003

RustyNails Helper II
Helper II

Re: Filter Data based on a specific row value

Hello, unfortunately this will not work. I think a better way to illustrate the problem I have is if I lay out my table horizontally.

 

 

image.png

 

Keep in mind this is just for illustrative purposes: My table is vertical and not horizontal as shown above.

 

Other thing was that the end user wants to plan based on Project Finalized date slicer so they can plan whats coming up for Q2, Q3 for example.

RustyNails Helper II
Helper II

Re: Filter Data based on a specific row value

Bumping 😛

 

Any takers?

Community Support
Community Support

Re: Filter Data based on a specific row value

hi, @RustyNails 

 For example, I can't show 5 Project Approveds between Q1 and Q2  even though I have only 2 Project Finalizeds in Q1.  The 2 Project Approveds should be a subset of the 2 Project Finalized for Q1. Is there a way to limit this in DAX?

I'm a little confused about your description?

Could you explain it with the sample data? what is your expected output and what is your current output?

https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490

 

Best Regards,

Lin

 

 

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

Helpful resources

Announcements
Announcing the New Spanish Forum

Announcing the New Spanish Forum

Do you need help in Spanish? Check out our new Spanish community section.

April 2020 Community Highlights

April 2020 Community Highlights

Info on our Super Users, MBAS content and badges, and updates to our support articles. - Read the full Community Highlights.

MBAS Gallery 2020

MBAS Gallery 2020

Watch Microsoft Business Applications Summit sessions on-demand.

Top Solution Authors
Top Kudoed Authors