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

Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.

Reply
Saxon10
Post Prodigy
Post Prodigy

Calculate distinct based on the two columns

In data table I have 3 columns are Team, Id and result.

In result column contain win, loss and no result.

If same team and id contain win, loss and no result then return "Multiple".

If same team and id contain win then return "win".

If same team and id contain loss then return "loss".

If same team and id contain win and no result then return "win".

If same team and id contain loss and no result then return "loss".

 

TeamIDResultDesired Report
TR1SWinMultiple
TR1SWinMultiple
TR1SNo ResultMultiple
TR1SNo ResultMultiple
TR1SLossMultiple
TR1SLossMultiple
TR2SWinMultiple
TR2SWinMultiple
TR2SLossMultiple
TR2SLossMultiple
TR3SLossLoss
TR3SLossLoss
TR4SWinWin
TR4SWinWin
TR5SNo ResultWin
TR5SwinWin
TR6SLossLoss
TR6SNo ResultLoss

 

Saxon10_0-1628713715880.png

 

3 ACCEPTED SOLUTIONS
Jos_Woolley
Solution Sage
Solution Sage

Hi,

NewColumn =
VAR MyTeam = 'Table'[Team]
VAR MyID = 'Table'[ID]
VAR MyTeamIDWins =
    CALCULATE (
        COUNTROWS ( FILTER ( 'Table', 'Table'[Team] = MyTeam && 'Table'[ID] = MyID ) ),
        'Table'[Result] = "Win"
    )
VAR MyTeamIDLosses =
    CALCULATE (
        COUNTROWS ( FILTER ( 'Table', 'Table'[Team] = MyTeam && 'Table'[ID] = MyID ) ),
        'Table'[Result] = "Loss"
    )
RETURN
    SWITCH (
        1 * ( MyTeamIDWins > 0 ) + 2 * ( MyTeamIDLosses > 0 ),
        1, "Win",
        2, "Loss",
        3, "Multiple"
    )

Regards

View solution in original post

AlexisOlson
Super User
Super User

How about this?

Desired Report =
VAR Results =
    CALCULATETABLE (
        VALUES ( Table1[Result] ),
        ALLEXCEPT ( Table1, Table1[Team], Table1[ID] ),
        Table1[Result] <> "No Result"
    )
RETURN
    SWITCH (
        TRUE (),
        COUNTROWS ( Results ) = 0, "No Result",
        COUNTROWS ( Results ) = 1, Results,
        COUNTROWS ( Results ) > 1, "Multiple"
    )

View solution in original post

Saxon10
Post Prodigy
Post Prodigy

Thanks for your reply and solution for @Jos_Woolley  and @AlexisOlson and sorry for the late reply. 

Both solutions are working well. 

View solution in original post

3 REPLIES 3
Saxon10
Post Prodigy
Post Prodigy

Thanks for your reply and solution for @Jos_Woolley  and @AlexisOlson and sorry for the late reply. 

Both solutions are working well. 

AlexisOlson
Super User
Super User

How about this?

Desired Report =
VAR Results =
    CALCULATETABLE (
        VALUES ( Table1[Result] ),
        ALLEXCEPT ( Table1, Table1[Team], Table1[ID] ),
        Table1[Result] <> "No Result"
    )
RETURN
    SWITCH (
        TRUE (),
        COUNTROWS ( Results ) = 0, "No Result",
        COUNTROWS ( Results ) = 1, Results,
        COUNTROWS ( Results ) > 1, "Multiple"
    )
Jos_Woolley
Solution Sage
Solution Sage

Hi,

NewColumn =
VAR MyTeam = 'Table'[Team]
VAR MyID = 'Table'[ID]
VAR MyTeamIDWins =
    CALCULATE (
        COUNTROWS ( FILTER ( 'Table', 'Table'[Team] = MyTeam && 'Table'[ID] = MyID ) ),
        'Table'[Result] = "Win"
    )
VAR MyTeamIDLosses =
    CALCULATE (
        COUNTROWS ( FILTER ( 'Table', 'Table'[Team] = MyTeam && 'Table'[ID] = MyID ) ),
        'Table'[Result] = "Loss"
    )
RETURN
    SWITCH (
        1 * ( MyTeamIDWins > 0 ) + 2 * ( MyTeamIDLosses > 0 ),
        1, "Win",
        2, "Loss",
        3, "Multiple"
    )

Regards

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors