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

Next up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now

Reply
Anonymous
Not applicable

Title: "Comparing Test Cases Between Different Versions in Power BI"

I have a dataset with two columns: "Test Case" and "Version."

  • Different versions can contain the same or different test cases.
  • In Power BI, I've created a matrix to display test cases for different versions side by side.
  • I also have a slicer that allows users to select two versions for comparison.
  • Let's say Version 1.1 is the older version, and Version 1.2 is the newer one.
  • I want to know how to:
    1. Generate a table or use another method to display a list of test cases that have been removed from Version 1.2 compared to Version 1.1.
    2. Generate a table or use another method to display a list of test cases that have been added to Version 1.2.
    3. Generate a table or use another method to display a list of test cases that are common to both Version 1.1 and Version 1.2.

here is my current solution but the list it return can not be displayed in a table, only showing as a string list can be displayed as a value in a matrix table. 

 

RemovedTestCases =
VAR SelectedVersions = VALUES('data'[Version])
VAR SelectedVersionCount = COUNTROWS(SelectedVersions)

RETURN
IF(
    SelectedVersionCount = 2,
    VAR SelectedVersionA = MINX(SelectedVersions, [Version])
    VAR SelectedVersionB = MAXX(SelectedVersions, [Version])
    VAR RemovedTestCasesList =
        EXCEPT(
            VALUES('data'[Test Case]),
            CALCULATETABLE(
                VALUES('data'[Test Case]),
                'data'[Version] = SelectedVersionB
            )
        )
    RETURN
    CONCATENATEX(RemovedTestCasesList, 'data'[Test Case], UNICHAR(10),
    BLANK()
)

)
 
here is the sample data: 
Test CaseVersion
A1.1Version 1.1
A1.2Version 1.1
A1.3Version 1.2
A1.2Version 1.2
A1.1Version 1.3
A1.6Version 1.3
A1.2Version 1.3
  
1 ACCEPTED SOLUTION

Hi @Anonymous, try this approach:

Test Case Status = 
VAR _CurrentTestCase = SELECTEDVALUE( 'Table'[Test Case] )                      //obtain TestCase from current row
VAR _CurrentVersion = SELECTEDVALUE( 'Table'[Version] )                         //obtain version of currently selected TestCase
VAR _VersionToCompare = SELECTEDVALUE( 'Compare version'[Version] )             //obtain a version you want to compare to

VAR _CurrentTestCaseALL =                                                       //let's get all unique values of the version of the currently selected TestCase. It will be used to make comparison of item presence in prev version
    CALCULATETABLE(
        VALUES( 'Table'[Test Case] ),
        REMOVEFILTERS( 'Table'[Version], 'Table'[Test Case] ),                  //remove any filters applied on 'Table' 
        'Table'[Version] = _CurrentVersion
    )
VAR _ToCompareTestCaseALL =                                                     //now let's get all possible unique values of TestCase we want to compare to 
    CALCULATETABLE(
        VALUES( 'Table'[Test Case] ),
        REMOVEFILTERS( 'Table'[Version], 'Table'[Test Case] ),                  //remove any filters applied on 'Table' 
        'Table'[Version] = _VersionToCompare
    )

VAR _CommonRows = INTERSECT( _ToCompareTestCaseALL, _CurrentTestCaseALL )       //returns only rows present in both versions
VAR _NewRows = EXCEPT( _CurrentTestCaseALL, _ToCompareTestCaseALL )             //get only new rows, i.e. present with TestCase of ToCompare version

VAR _Result =
    IF(
        _CurrentTestCase in _NewRows,
        "New in " & _CurrentVersion,
        "Present in " & _VersionToCompare
    )
RETURN _Result

 

Sergii24_0-1695680988242.png


Make sure to turn on single select for filters and create a disconnected table with version values:

Sergii24_1-1695681074888.png

 

Good luck! 🙂

 

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

Hi @Anonymous ,

Please have a try.

RemovedTestCasesPercentage =
VAR SelectedVersionA = "Version 1.1"
VAR SelectedVersionB = "Version 1.2"
VAR TotalTestCases =
    COUNTROWS ( VALUES ( data[Test Case] ) )
VAR RemovedTestCases =
    COUNTROWS (
        EXCEPT (
            CALCULATETABLE ( VALUES ( data[Test Case] ), data[Version] = SelectedVersionA ),
            CALCULATETABLE ( VALUES ( data[Test Case] ), data[Version] = SelectedVersionB )
        )
    )
RETURN
    DIVIDE ( RemovedTestCases, TotalTestCases )

 

How to Get Your Question Answered Quickly 

 

If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .

 

Best Regards
Community Support Team _ Rongtie

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

 

 

 

Anonymous
Not applicable

Thanks, Rongtie, 

I want to display a list of removed items in a table, not the percentage of removed test cases. also the 2 selectedVersion values are  not fixed value, they should be any 2 values that the user selects from a version slicer. 

Hi @Anonymous, try this approach:

Test Case Status = 
VAR _CurrentTestCase = SELECTEDVALUE( 'Table'[Test Case] )                      //obtain TestCase from current row
VAR _CurrentVersion = SELECTEDVALUE( 'Table'[Version] )                         //obtain version of currently selected TestCase
VAR _VersionToCompare = SELECTEDVALUE( 'Compare version'[Version] )             //obtain a version you want to compare to

VAR _CurrentTestCaseALL =                                                       //let's get all unique values of the version of the currently selected TestCase. It will be used to make comparison of item presence in prev version
    CALCULATETABLE(
        VALUES( 'Table'[Test Case] ),
        REMOVEFILTERS( 'Table'[Version], 'Table'[Test Case] ),                  //remove any filters applied on 'Table' 
        'Table'[Version] = _CurrentVersion
    )
VAR _ToCompareTestCaseALL =                                                     //now let's get all possible unique values of TestCase we want to compare to 
    CALCULATETABLE(
        VALUES( 'Table'[Test Case] ),
        REMOVEFILTERS( 'Table'[Version], 'Table'[Test Case] ),                  //remove any filters applied on 'Table' 
        'Table'[Version] = _VersionToCompare
    )

VAR _CommonRows = INTERSECT( _ToCompareTestCaseALL, _CurrentTestCaseALL )       //returns only rows present in both versions
VAR _NewRows = EXCEPT( _CurrentTestCaseALL, _ToCompareTestCaseALL )             //get only new rows, i.e. present with TestCase of ToCompare version

VAR _Result =
    IF(
        _CurrentTestCase in _NewRows,
        "New in " & _CurrentVersion,
        "Present in " & _VersionToCompare
    )
RETURN _Result

 

Sergii24_0-1695680988242.png


Make sure to turn on single select for filters and create a disconnected table with version values:

Sergii24_1-1695681074888.png

 

Good luck! 🙂

 

Anonymous
Not applicable

This is very helpful. Thank you!!!

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

FabCon and SQLCon Highlights Carousel

FabCon &SQLCon Highlights

Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.