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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
AdiSarah55
New Member

Create comparison on same data source

HI, 
i really need your support, i'm strugling with many AI progrmas but still couldn't find the good answer.
i have data table in powerbi looks like this:
hash per build, with all tests verdicts and actual

hashbuildtest1 verdicttest1 actualtest2 verdicttest2 actualtest3 verdicttest3 actual
12341pass1fail4passgreat
12342pass2fail5passgreat
23451pass3pass6passpoor
23452fail4pass4passgreat
34561fail4pass4passpoor
34562pass5fail4failpoor

 

i need to create 2 tables, 1 that present the tests that were changed between the 2 builds, and 1 that present the tests that were not changed:
not changed:

testhashverdict build1verdict build2actual build1 actual build2
test1 1234passpass12
test21234failfail45
test31234passpassgreatgreat
test22345passpass64
test32345passpasspoor

great

changed: 

testhashverdict build1verdict build2actual build1 actual build2
test12345passfail34
test1 3456failpass45
test23456passfail44
test33456passfailpoor

poor

 

the purpose is to compare between 2 builds and see changes, so i giv 2 filters baseBuild and CompareBuild
now i need to take out the data per build.

is that even possible? I'm desperate 😞

the main issue is to filter by build number 2 different filters...

1 ACCEPTED SOLUTION
kushanNa
Super User
Super User

Hi @AdiSarah55 

 

follow this method

 

first create an unpivot table

 

unpivotnewtable = 
UNION(
    SELECTCOLUMNS(
        'YourTable', 
        "hash", 'YourTable'[hash], 
        "build", 'YourTable'[build], 
        "test", "test1", 
        "verdict", 'YourTable'[test1 verdict], 
        "actual", 'YourTable'[test1 actual]
    ),
    SELECTCOLUMNS(
        'YourTable', 
        "hash", 'YourTable'[hash], 
        "build", 'YourTable'[build], 
        "test", "test2", 
        "verdict", 'YourTable'[test2 verdict], 
        "actual", 'YourTable'[test2 actual]
    ),
    SELECTCOLUMNS(
        'YourTable', 
        "hash", 'YourTable'[hash], 
        "build", 'YourTable'[build], 
        "test", "test3", 
        "verdict", 'YourTable'[test3 verdict], 
        "actual", 'YourTable'[test3 actual]
    )
)

kushanNa_1-1742788599780.png

and then create two separate table for build picks 

first pick = DISTINCT(unpivotnewtable[build] )
second pick = DISTINCT(unpivotnewtable[build] )

 

and create this measure 

 

Change Check = 
VAR FirstPickBuild = SELECTEDVALUE('first pick'[build])
VAR SecondPickBuild = SELECTEDVALUE('second pick'[build])

VAR FirstPickVerdict =
    CALCULATE (
        MAX ( 'unpivotnewtable'[verdict] ),
        'unpivotnewtable'[build] = FirstPickBuild,
        ALLEXCEPT('unpivotnewtable', 'unpivotnewtable'[hash], 'unpivotnewtable'[test])
    )

VAR SecondPickVerdict =
    CALCULATE (
        MAX ( 'unpivotnewtable'[verdict] ),
        'unpivotnewtable'[build] = SecondPickBuild,
        ALLEXCEPT('unpivotnewtable', 'unpivotnewtable'[hash], 'unpivotnewtable'[test])
    )

RETURN
    IF ( FirstPickVerdict = SecondPickVerdict, "0", "1" )

 

and create two new tables in visual and add change check measure as a filter and for 1 table ask it to show 0 (not changed) and for other 1 (changed)

 

create two filter for the comparison between builds

 

kushanNa_2-1742788955433.png

 

 

View solution in original post

10 REPLIES 10
v-pnaroju-msft
Community Support
Community Support

Hi AdiSarah55,

We are following up to see if your query has been resolved. Should you have identified a solution, we kindly request you to share it with the community to assist others facing similar issues.

If our response was helpful, please mark it as the accepted solution and provide kudos, as this helps the broader community.

Thank you.

v-pnaroju-msft
Community Support
Community Support

Hi AdiSarah55,

We wanted to check in regarding your query, as we have not heard back from you. If you have resolved the issue, sharing the solution with the community would be greatly appreciated and could help others encountering similar challenges.

If you found our response useful, kindly mark it as the accepted solution and provide kudos to guide other members.

Thank you.

v-pnaroju-msft
Community Support
Community Support

Hi AdiSarah55,

We are following up to see if your query has been resolved. Should you have identified a solution, we kindly request you to share it with the community to assist others facing similar issues.

If our response was helpful, please mark it as the accepted solution and provide kudos, as this helps the broader community.

Thank you.

kushanNa
Super User
Super User

Hi @AdiSarah55 

 

follow this method

 

first create an unpivot table

 

unpivotnewtable = 
UNION(
    SELECTCOLUMNS(
        'YourTable', 
        "hash", 'YourTable'[hash], 
        "build", 'YourTable'[build], 
        "test", "test1", 
        "verdict", 'YourTable'[test1 verdict], 
        "actual", 'YourTable'[test1 actual]
    ),
    SELECTCOLUMNS(
        'YourTable', 
        "hash", 'YourTable'[hash], 
        "build", 'YourTable'[build], 
        "test", "test2", 
        "verdict", 'YourTable'[test2 verdict], 
        "actual", 'YourTable'[test2 actual]
    ),
    SELECTCOLUMNS(
        'YourTable', 
        "hash", 'YourTable'[hash], 
        "build", 'YourTable'[build], 
        "test", "test3", 
        "verdict", 'YourTable'[test3 verdict], 
        "actual", 'YourTable'[test3 actual]
    )
)

kushanNa_1-1742788599780.png

and then create two separate table for build picks 

first pick = DISTINCT(unpivotnewtable[build] )
second pick = DISTINCT(unpivotnewtable[build] )

 

and create this measure 

 

Change Check = 
VAR FirstPickBuild = SELECTEDVALUE('first pick'[build])
VAR SecondPickBuild = SELECTEDVALUE('second pick'[build])

VAR FirstPickVerdict =
    CALCULATE (
        MAX ( 'unpivotnewtable'[verdict] ),
        'unpivotnewtable'[build] = FirstPickBuild,
        ALLEXCEPT('unpivotnewtable', 'unpivotnewtable'[hash], 'unpivotnewtable'[test])
    )

VAR SecondPickVerdict =
    CALCULATE (
        MAX ( 'unpivotnewtable'[verdict] ),
        'unpivotnewtable'[build] = SecondPickBuild,
        ALLEXCEPT('unpivotnewtable', 'unpivotnewtable'[hash], 'unpivotnewtable'[test])
    )

RETURN
    IF ( FirstPickVerdict = SecondPickVerdict, "0", "1" )

 

and create two new tables in visual and add change check measure as a filter and for 1 table ask it to show 0 (not changed) and for other 1 (changed)

 

create two filter for the comparison between builds

 

kushanNa_2-1742788955433.png

 

 

Thanks again @kushanNa for your helpful support!!🤓 really appreciate! 
i see your example, and in the table you present we can see only build 1 & 2 
since your original table includes only builds 1 & 2 probably, i have many builds so i can't show in the table only the selected builds,,, 
BTW do i need to link the "first pick" and "second pick" tables to the unpivot table?

you are welcome & no need to link 

kushanNa
Super User
Super User

hi

 

first create a unpivoted table 

 

kushanNa_0-1742536928487.png

 

UnpivotedTableWithDuplicateCheck = 
ADDCOLUMNS (
    UNION(
        SELECTCOLUMNS(
            'YourTable', 
            "hash", 'YourTable'[hash], 
            "build", 'YourTable'[build], 
            "test", "test1", 
            "verdict", 'YourTable'[test1 verdict], 
            "actual", 'YourTable'[test1 actual]
        ),
        SELECTCOLUMNS(
            'YourTable', 
            "hash", 'YourTable'[hash], 
            "build", 'YourTable'[build], 
            "test", "test2", 
            "verdict", 'YourTable'[test2 verdict], 
            "actual", 'YourTable'[test2 actual]
        ),
        SELECTCOLUMNS(
            'YourTable', 
            "hash", 'YourTable'[hash], 
            "build", 'YourTable'[build], 
            "test", "test3", 
            "verdict", 'YourTable'[test3 verdict], 
            "actual", 'YourTable'[test3 actual]
        )
    ),
    "DuplicateCheck", 
    IF (
        COUNTROWS (
            FILTER (
                UNION(
                    SELECTCOLUMNS(
                        'YourTable', 
                        "hash", 'YourTable'[hash], 
                        "build", 'YourTable'[build], 
                        "test", "test1", 
                        "verdict", 'YourTable'[test1 verdict], 
                        "actual", 'YourTable'[test1 actual]
                    ),
                    SELECTCOLUMNS(
                        'YourTable', 
                        "hash", 'YourTable'[hash], 
                        "build", 'YourTable'[build], 
                        "test", "test2", 
                        "verdict", 'YourTable'[test2 verdict], 
                        "actual", 'YourTable'[test2 actual]
                    ),
                    SELECTCOLUMNS(
                        'YourTable', 
                        "hash", 'YourTable'[hash], 
                        "build", 'YourTable'[build], 
                        "test", "test3", 
                        "verdict", 'YourTable'[test3 verdict], 
                        "actual", 'YourTable'[test3 actual]
                    )
                ),
                [test] = EARLIER([test]) &&
                [hash] = EARLIER([hash]) &&
                [verdict] = EARLIER([verdict])
            )
        ) > 1, 
        "Not Changed", 
        "Changed"
    )
)

 

and create other two tables 

 

changed table

kushanNa_1-1742536974958.png

ChangedTable = 
FILTER (
    UnpivotedTableWithDuplicateCheck, 
    UnpivotedTableWithDuplicateCheck[DuplicateCheck] = "Changed"
)

 

not changed table

kushanNa_2-1742537006186.png

NotChangedTable = 
FILTER (
    UnpivotedTableWithDuplicateCheck, 
    UnpivotedTableWithDuplicateCheck[DuplicateCheck] = "Not Changed"
)

 

thanks @kushanNa for your help!
your answer is great if the build are known in advance, but as i mentioned, i want to give the user the option to choose which builds to compare (1 & 2 are examples, we have many results for several builds, and i want the user to select build1 and build2. is there an option to do it?

bhanu_gautam
Super User
Super User

 @AdiSarah55 

Create a calculated table for tests that were not changed:

Go to the "Modeling" tab and select "New Table".
Use the following DAX formula to create the table for tests that were not changed:

dax
NotChangedTests =
VAR BaseBuild = 1 -- Replace with your base build filter
VAR CompareBuild = 2 -- Replace with your compare build filter
RETURN
FILTER(
ADDCOLUMNS(
CROSSJOIN(
DISTINCT(SELECTCOLUMNS('Table', "Test", 'Table'[test1 verdict], 'Table'[test2 verdict], 'Table'[test3 verdict])),
DISTINCT(SELECTCOLUMNS('Table', "Hash", 'Table'[hash]))
),
"VerdictBuild1", LOOKUPVALUE('Table'[test1 verdict], 'Table'[hash], [Hash], 'Table'[build], BaseBuild),
"VerdictBuild2", LOOKUPVALUE('Table'[test1 verdict], 'Table'[hash], [Hash], 'Table'[build], CompareBuild),
"ActualBuild1", LOOKUPVALUE('Table'[test1 actual], 'Table'[hash], [Hash], 'Table'[build], BaseBuild),
"ActualBuild2", LOOKUPVALUE('Table'[test1 actual], 'Table'[hash], [Hash], 'Table'[build], CompareBuild)
),
[VerdictBuild1] = [VerdictBuild2] && [ActualBuild1] = [ActualBuild2]
)

 

Create a calculated table for tests that were changed:
Go to the "Modeling" tab and select "New Table".
Use the following DAX formula to create the table for tests that were changed:

dax
ChangedTests =
VAR BaseBuild = 1 -- Replace with your base build filter
VAR CompareBuild = 2 -- Replace with your compare build filter
RETURN
FILTER(
ADDCOLUMNS(
CROSSJOIN(
DISTINCT(SELECTCOLUMNS('Table', "Test", 'Table'[test1 verdict], 'Table'[test2 verdict], 'Table'[test3 verdict])),
DISTINCT(SELECTCOLUMNS('Table', "Hash", 'Table'[hash]))
),
"VerdictBuild1", LOOKUPVALUE('Table'[test1 verdict], 'Table'[hash], [Hash], 'Table'[build], BaseBuild),
"VerdictBuild2", LOOKUPVALUE('Table'[test1 verdict], 'Table'[hash], [Hash], 'Table'[build], CompareBuild),
"ActualBuild1", LOOKUPVALUE('Table'[test1 actual], 'Table'[hash], [Hash], 'Table'[build], BaseBuild),
"ActualBuild2", LOOKUPVALUE('Table'[test1 actual], 'Table'[hash], [Hash], 'Table'[build], CompareBuild)
),
[VerdictBuild1] <> [VerdictBuild2] || [ActualBuild1] <> [ActualBuild2]
)

 

Adjust the filters: Replace BaseBuild and CompareBuild with the actual build numbers you want to compare.

Visualize the tables: Use table visualizations to display the NotChangedTests and ChangedTests tables.




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






thanks @bhanu_gautam for your answer! the main issue is to distinguish between the 2 build filters, 
so when you are saying :
VAR BaseBuild = 1 -- Replace with your base build filter
VAR CompareBuild = 2 -- Replace with your compare build filter
what do u mean?
i have a table and build column there, there is no name for filters....

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors