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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
RustyNails
Helper III
Helper III

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
RustyNails
Helper III
Helper III

Bumping 😛

 

Any takers?

nmck86
Post Patron
Post Patron

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

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.

v-lili6-msft
Community Support
Community Support

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.

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.

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
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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