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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
sujaisparks
Advocate I
Advocate I

How to calculate percentage covered vs not covered

Please help me with this scenario at hand

 

I have a factless fact table imported into a Power BI Desktop model that contains the product modules with Testcase Groups and Testcases as shown in the example below:

 

Module  TestCaseGroup   TestCaseID   
AG1101
AG1102
AG2101
AG2102
AG2103
AG2104
AG3102
AG3105
BG4201
BG4203
BG5201
BG5202
BG5203

 

What I need to calculate and show in Power BI Desktop is two things:

  1. When I select a Module (in slicer) and a Testcase Group (in slicer), how can I calculate the count or percentage of Testcases not covered by the Testcase Group for the selected module.  For example, if I select module A in the above table, there are total 5 distinct testcases. Within that module, if I select Testcase Group G1, the count of testcases covered is 2 and count of test cases not covered is 3. Similarly if I select G2, it is 4 vs 1.
  2.  Also if possible, how to show the list of distinct testcaseids that are not covered by the selected Testcase Group for the selected module

 

Please kindly help.

3 ACCEPTED SOLUTIONS
Zubair_Muhammad
Community Champion
Community Champion

HI @sujaisparks

 

Try these MEASURES

 

Test_Cases_Covered =
DISTINCTCOUNT ( TableName[TestCaseID] )
Test_Cases_Not_Covered =
CALCULATE (
    DISTINCTCOUNT ( TableName[TestCaseID] ),
    ALL ( TableName[TestCaseGroup] )
)
    - [Test_Cases_Covered]

View solution in original post

@sujaisparks

 

To get the Names of IDs not covered, you can use this MEASURE

 

IDs not covered =
CONCATENATEX (
    EXCEPT (
        CALCULATETABLE (
            VALUES ( TableName[TestCaseID] ),
            ALL ( TableName[TestCaseGroup] )
        ),
        VALUES ( TableName[TestCaseID] )
    ),
    [TestCaseID],
    ", "
)

View solution in original post

5 REPLIES 5
Zubair_Muhammad
Community Champion
Community Champion

HI @sujaisparks

 

Try these MEASURES

 

Test_Cases_Covered =
DISTINCTCOUNT ( TableName[TestCaseID] )
Test_Cases_Not_Covered =
CALCULATE (
    DISTINCTCOUNT ( TableName[TestCaseID] ),
    ALL ( TableName[TestCaseGroup] )
)
    - [Test_Cases_Covered]

Tons of thanks to you sir for the help!!

What changes do I have to do the measure (Test_cases_not_covered) if need to put the TestcaseGroup Dimension attribute (TestcaseGroupDescription) as a slicer. This is a snapshot of the relationship with the factless fact table.

 

Relationship Diagram.png

 

Here is the copy of the poc i'm working on My POC

Tons of thanks to you sir for the help!!

What changes do I have to do the measure (Test_cases_not_covered) if need to put the TestcaseGroup Dimension attribute (TestcaseGroupDescription) as a slicer. This is a snapshot of the relationship with the factless fact table.

 

Relationship Diagram.png

 

Here is the copy of the poc i'm working on My POC

@sujaisparks

 

To get the Names of IDs not covered, you can use this MEASURE

 

IDs not covered =
CONCATENATEX (
    EXCEPT (
        CALCULATETABLE (
            VALUES ( TableName[TestCaseID] ),
            ALL ( TableName[TestCaseGroup] )
        ),
        VALUES ( TableName[TestCaseID] )
    ),
    [TestCaseID],
    ", "
)

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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