cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Count combined rows

Hello, 

I´m new on power bi,  so I would like to know if the following is possible: 

 

The following table shows products by ticket and I would like to know:  

1.  how many times the combination of Product A and B  will appears, in this table Product A and  Product B will appear 3 times (Ticket: 10,11 and 13) .

2. how many times the combination of Product B and D will appears, in this table Product B and Product D will appears 2 times (Ticket 18 and 21) .

 

Is it possible to do it on Power BI?

 

TickestProducts
10A
10B
14B
14D
11A
11B
12A
12G
13A
13B
17B
17F
18B
18D
20C
20D
21B
21D

 

I hope i was clear 

Thanks.... 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
v-cherch-msft Super Contributor
Super Contributor

Re: Count combined rows

Hi @Anonymous 

You may create measures as below:

Measure_A&B =
VAR a =
    CALCULATETABLE (
        VALUES ( Table1[Products] ),
        ALLEXCEPT ( Table1, Table1[Tickest] )
    )
RETURN
    IF ( { "A" } IN a && { "B" } IN a, 1 )
A&B_Count = CALCULATE(DISTINCTCOUNT(Table1[Tickest]),FILTER(Table1,[Measure_A&B]=1))

1.png

Regards,

Community Support Team _ Cherie Chen
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
2 REPLIES 2
HotChilli New Contributor
New Contributor

Re: Count combined rows

a) create a table

Table = 
VAR _tickswithA = SUMMARIZE( FILTER(Table1, Table1[Products] = "A") , Table1[Tickest])
VAR _ticketswithB = SUMMARIZE( FILTER(Table1, Table1[Products] = "B") , Table1[Tickest])
RETURN
INTERSECT(_tickswithA, _ticketswithB)

b) B,D is similar.  There are lots of ways to do this.

p.s. B, D appears 3 times

Highlighted
v-cherch-msft Super Contributor
Super Contributor

Re: Count combined rows

Hi @Anonymous 

You may create measures as below:

Measure_A&B =
VAR a =
    CALCULATETABLE (
        VALUES ( Table1[Products] ),
        ALLEXCEPT ( Table1, Table1[Tickest] )
    )
RETURN
    IF ( { "A" } IN a && { "B" } IN a, 1 )
A&B_Count = CALCULATE(DISTINCTCOUNT(Table1[Tickest]),FILTER(Table1,[Measure_A&B]=1))

1.png

Regards,

Community Support Team _ Cherie Chen
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Can You Solve These Challenge

Challenge: Can You Solve These?

Find out how to participate in the first Power BI 'Can You Solve These?' challenge.

Community News & Announcements

Community News & Announcements

Get your latest community news and announcements.

Virtual Launch Event

Microsoft Business Applications October Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

Community Kudopalooza

Win Power BI Swag with Community Kudopalooza!

Each week, complete activities and be qualified in the drawing for cool Power BI Swag.

Users Online
Currently online: 206 members 2,468 guests
Please welcome our newest community members: