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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
WinterGarden
Helper III
Helper III

Dax/Measure for calculating the count based on filters applied in another table

Hi,
I've 2 tables , 
Engagement details:

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


Project Summary:

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

 

I've a filter/slicer ie. Lead(from Engagement details table) in the page.
i need to calculate the count for each engagements where Category = NC and Finding Status = Open.
while clicking each Engagement Name in the table view , i need to show the count in a card.
basically need a measure which filters Project Summary table based on  below conditions:
1)Engagement Name = values filtered from Engagement details where lead = selected value
2)Category = NC and Finding Status = Open.
can anyone help me with the measure for calculating the count.

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @WinterGarden ,

 

If you cannot create a relationship between tables because of relationship ambiguity.

vcgaomsft_0-1724730954125.png

You might try the TREATAS function:

MEASURE = 
CALCULATE (
    COUNTROWS ( 'Project Summary' ),
    'Project Summary'[Category] = "NC"
        && 'Project Summary'[Finding Status] = "Open",
    TREATAS (
        VALUES ( 'Engagement details'[Engagement Name] ),
        'Project Summary'[Engagement Name]
    )
)

vcgaomsft_1-1724731138938.png

 

TREATAS - DAX Guide

 

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum

View solution in original post

7 REPLIES 7
Jihwan_Kim
Super User
Super User

Hi,

Please check the below picture and the attached pbix file.

 

Jihwan_Kim_0-1724602852929.png

 

Jihwan_Kim_1-1724603133009.png

 

 

expected result measure: = 
COUNTROWS(
    FILTER('Project summary',
    'Project summary'[Category] = "NC" &&
    'Project summary'[Finding Status] = "Open"
    )
)

 

 

 


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.
shafiz_p
Super User
Super User

Hi @WinterGarden  Considering the relationship Engagement details to Engagement summary. Please create the below measure to calculate count of Engagement.

Count of Engagement =
COUNTROWS(
    FILTER('Engagement Summary',
    'Engagement Summary'[Category] = "NC" &&
    'Engagement Summary'[Finding Status] = "Open"
    )
)
 
Hope this helps!!

If this solved your problem, please accept it as a solution!!

Best Regards,
Shahariar Hafiz

Hi @shafiz_p ,
this wont work in my case beacuse..
i am displaying the "Engagement Name" from Engagement details table along with few other colums from another table in a table visual.
Also i cant create direct relationship between these two tables as it cause ambiguity issue.
my ask is , if i selected lead = A, then the Engagement Names= ENG 1, ENG 2.
now i need to show the count ENG 1, ENG 2 where Category = NC and Finding Status = Open.
i need a measure which filters Project Summary table based on  below conditions:
1)Engagement Name = values filtered from Engagement details where lead = selected value
2)Category = NC and Finding Status = Open.

@WinterGarden  This is perfectly working for me. See the image below:

shafiz_p_0-1724603842183.png

 

shafiz_p_1-1724603866784.png

 

shafiz_p_2-1724603884665.png

 

See the relationship also.

shafiz_p_3-1724603913476.png


This is based on your provided data. Since you are faceing problem, then I would suggest you to provide complete picture, so that community can help you.

Hope this helps.

 

Hi @shafiz_p/@Jihwan_Kim  ,
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

WinterGarden_1-1724604735479.png

 

 

@WinterGarden  I think you have problem with your relationship. You are counting, aggregating all from IDR table but relationship direction as per your statement "IDR(Project Name) to Engagement tracker(Project Name)". Also you don't have any relationship between Project dimention table to IDR table. So if you filter anything from Engagement tracker, it would not propagate the IDR table. 

I would suggest Identify your dimension and fact table, and create relationship.

Anonymous
Not applicable

Hi @WinterGarden ,

 

If you cannot create a relationship between tables because of relationship ambiguity.

vcgaomsft_0-1724730954125.png

You might try the TREATAS function:

MEASURE = 
CALCULATE (
    COUNTROWS ( 'Project Summary' ),
    'Project Summary'[Category] = "NC"
        && 'Project Summary'[Finding Status] = "Open",
    TREATAS (
        VALUES ( 'Engagement details'[Engagement Name] ),
        'Project Summary'[Engagement Name]
    )
)

vcgaomsft_1-1724731138938.png

 

TREATAS - DAX Guide

 

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.