Forum Discussion

WinterGarden's avatar
WinterGarden
Resolver I
2 years ago
Solved

Measure for filtering a table based on filtered values from another table

Hi,

In the below screenshot,

 


"Delivery Lead" is the lead filter, which is from a master table called Engagement tracker.
"Project Name" column in the table visual is from a table called project Dimension which contains all the project names.
Then the count values, observation & NC that is calculated from IDR table
Now the relationship part:
1) Engagement tracker(Project Name) ---- project Dimension(Project Name)
2) IDR(Project Name) --- Engagement tracker(Project Name)
based on the selected "Delivery Lead" in need to calculate the observation & NC count from IDR table..
show the total NC count for that "Delivery Lead" if no projects are selected from that table view , else show the NC count for that specific project selected in the table view
basically need a measure which calculates the count of Project Name by filtering IDR table based on  below conditions:
1)Project Name = values filtered from project Dimension where lead = selected value of Delivery Lead
2)Category = NC and Finding Status = Open.
for eg: if Lead = A, 
filtered project names = ENG 1, ENG 2
Total NC count = 2
Data views:

Engagement tracker:

Project NameLead
ENG 1A
ENG 2A
ENG 3B
ENG 4C


project Dimension:

Project Name
ENG 1
ENG 2
ENG 3
ENG 4
ENG 5


IDR:

Project NameCategoryFinding Status
ENG 1NCClosed
ENG 1NCOpen
ENG 1ObservationOpen
ENG 2NCOpen
ENG 2ObservationOpen
ENG 3NCOpen
ENG 4NCOpen


can anyone help me with the measure for calculating the count.

 

 

 

  • Irwan's avatar
    Irwan
    2 years ago

    hello WinterGarden 

     

    sorry, my bad. i didnt read your post thoroughly, with "Open" filter it does become 2.

     

    so, here is the adjustment.

    create a new measure with following DAX

    NC Count = 
    var _Project = VALUES('Project'[Project Name])
    Return
    CALCULATE(
        COUNTROWS('IDR'),
        TREATAS(_Project,'IDR'[Project Name]),
        FILTER(
            'IDR',
            'IDR'[Category]="NC"&&
            'IDR'[Finding Status]="Open"
        )
    )
     
    as your requested, 
    1. no relationship between Project and IDR.

     

    2.1. Lead slicer from Engagement tbl

    2.2 Project slicer from Project tbl

     

    i assumed there is still a relationship between engagement and project since you didnt mentioned it.
    or is this saying about no relationship between those three tabels?

     

    Hope this will help.

    Thank you.

6 Replies

  • hello WinterGarden 

     

    is this what you are looking for?

     

    create a new measure with following DAX

    NC Count = CALCULATE(COUNTROWS('IDR'),'IDR'[Category]="NC")
     
    also the count should be 3, not 2 as you mentioned above.
    As you said, Lead "A" will filter "ENG 1" and "ENG 2".
    "ENG 1" has 2 NC and "ENG 2" has 1 NC.
    So total NC for Lead "A" is 3.
     
    Hope this will help you.
    Thank you.
    • WinterGarden's avatar
      WinterGarden
      Resolver I

      Hi Irwan ,

      Lead filter is from Engagement tracker table
      Project Name in that table visual is from project Dimension table
      i need to calculate the count of project name where category = NC and Finding Status = Open from IDR table.
      Also there is no relationship between IDR table and project Dimension table

      • Irwan's avatar
        Irwan
        Super User

        hello WinterGarden 

         

        sorry, my bad. i didnt read your post thoroughly, with "Open" filter it does become 2.

         

        so, here is the adjustment.

        create a new measure with following DAX

        NC Count = 
        var _Project = VALUES('Project'[Project Name])
        Return
        CALCULATE(
            COUNTROWS('IDR'),
            TREATAS(_Project,'IDR'[Project Name]),
            FILTER(
                'IDR',
                'IDR'[Category]="NC"&&
                'IDR'[Finding Status]="Open"
            )
        )
         
        as your requested, 
        1. no relationship between Project and IDR.

         

        2.1. Lead slicer from Engagement tbl

        2.2 Project slicer from Project tbl

         

        i assumed there is still a relationship between engagement and project since you didnt mentioned it.
        or is this saying about no relationship between those three tabels?

         

        Hope this will help.

        Thank you.