Forum Discussion
Title: "Comparing Test Cases Between Different Versions in Power BI"
- 2 years ago
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
Make sure to turn on single select for filters and create a disconnected table with version values:Good luck! 🙂
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.
- Anonymous2 years agoNot 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.
- Sergii242 years ago
Super User
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
Make sure to turn on single select for filters and create a disconnected table with version values:Good luck! 🙂
- Anonymous2 years agoNot applicable
This is very helpful. Thank you!!!