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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
sujaisparks
Regular Visitor

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]

Regards
Zubair

Please try my custom visuals

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],
    ", "
)

Regards
Zubair

Please try my custom visuals

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]

Regards
Zubair

Please try my custom visuals

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],
    ", "
)

Regards
Zubair

Please try my custom visuals

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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