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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
EaglesTony
Post Prodigy
Post Prodigy

How can I get 0 count for missing component

I have the following table called "tblComponentName (2) with the following field and data:

 

ComponentName

AppCode

Stakeholder

Technology

 

I have another table called "IssueComponents" with the following field and data:

 

Key       ComponentName

123       AppCode

123       Stakeholder

123       Technology

456       Stakeholder

 

What I need is to identify that 456 doesn't have AppCode and Technology, so I would want something like:

 

Key       AppCodeComponentPresent       StakeholderComponentPresent     TechnologyComponentPresent

123        Y                                                  Y                                                      Y

456        N                                                  Y                                                     Y

 

I think some sort of grouping would do this with a zero count ????

 

Thank you   

 

1 ACCEPTED SOLUTION

Hi @EaglesTony 

1. Create distinct lists of keys table and components table using DAX:

For key table

KeysList = DISTINCT('IssueComponents'[Key])

For Component Table
ComponentsList = DISTINCT('tblComponentName (2)'[ComponentName])


2. Create another table that performs a cross join of keys and components:

KeyComponentMatrix = 
GENERATE(
    KeysList,
    SELECTCOLUMNS(ComponentsList, "ComponentName", ComponentsList[ComponentName])
)


3. In the KeyComponentMatrix, add a calculated column to evaluate whether each component is present for a given key:

 

ComponentPresent = 
IF (
    CALCULATE (
        COUNTROWS('IssueComponents'),
        FILTER (
            'IssueComponents',
            'IssueComponents'[Key] = KeyComponentMatrix[Key]
                && 'IssueComponents'[ComponentName] = KeyComponentMatrix[ComponentName]
        )
    ) > 0,
    "Y",
    "N"
)


I have attached a snapshot for the tables i have created , please review it.

vkarpurapud_0-1747915432096.png


If this post helps , kindly mark it as Accepted Solution. Appreciate your Kudos.



Regards,
Karpurapu D.
 

 

View solution in original post

9 REPLIES 9
v-karpurapud
Community Support
Community Support

Hi @EaglesTony

Welcome to the Microsoft Fabric Forum. Also thank you @Ashish_Excel and @Bmejia for your quick response.

 

To obtain a count of zero for a missing component,  I have created a sample logic below to demonstrate one possible approach to implementing the desired output in Power BI.

 

While I may not have full visibility into the specific structure of your dataset, I’ve included relevant screenshot and attached the .pbix file for your reference. Please take a moment to review them and see if this solution aligns with your requirements.

vkarpurapud_0-1747906265733.png

 

If this doesn’t fully meet your needs, could you kindly share a sample of your data and more detailed context? That would help us provide a more accurate solution.
 

If this response resolves your query, kindly mark it as Accepted Solution to help other community members. A Kudos is also appreciated if you found the response helpful.
 

 

Thank you!
 

I can't download the .pbix due to business reasons. Is there a code snippet here of how you did it ?

Hi @EaglesTony 

1. Create distinct lists of keys table and components table using DAX:

For key table

KeysList = DISTINCT('IssueComponents'[Key])

For Component Table
ComponentsList = DISTINCT('tblComponentName (2)'[ComponentName])


2. Create another table that performs a cross join of keys and components:

KeyComponentMatrix = 
GENERATE(
    KeysList,
    SELECTCOLUMNS(ComponentsList, "ComponentName", ComponentsList[ComponentName])
)


3. In the KeyComponentMatrix, add a calculated column to evaluate whether each component is present for a given key:

 

ComponentPresent = 
IF (
    CALCULATE (
        COUNTROWS('IssueComponents'),
        FILTER (
            'IssueComponents',
            'IssueComponents'[Key] = KeyComponentMatrix[Key]
                && 'IssueComponents'[ComponentName] = KeyComponentMatrix[ComponentName]
        )
    ) > 0,
    "Y",
    "N"
)


I have attached a snapshot for the tables i have created , please review it.

vkarpurapud_0-1747915432096.png


If this post helps , kindly mark it as Accepted Solution. Appreciate your Kudos.



Regards,
Karpurapu D.
 

 

Is there a way to show them across a single row instead of multiple rows ?

 

I was thinking Groupby ?

 

Hi @EaglesTony 

If possible, try to download the PBIX file to your personal device. This will help you have a better understanding of the logic.

Ashish_Excel
Super User
Super User

Hi,

Create a relationship (Many to One and Single) from Table 2 to Table 1.  To your matrix visual, drag Key from Table 2 in the rows bucket and the the single field from Table 1 in the columns bucket.  Write this measure

Measure = countrows('Table2')

Hope this helps.

Bmejia
Super User
Super User

You can create a measure for each category as follows

AppCode = IF(
CALCULATE(
SELECTEDVALUE(IssueComponents[Key]),
IssueComponents[Component]="AppCode"),"Y","N")

A measure on what table ?

I have update my measure the table name base on what you provided, but believe if you only have a few keys that would be fine if you going to be adding alot more "v-karpurapud"  example would be more dynamic where if new keys are provided it would be done automatically rather then you having to create each measure everytime.

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.