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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
freelensia
Advocate II
Advocate II

Convert each value of column B into column headers, grouped by column A

I have a table Bounced Emails as follow:

 

Email         Bounce_Type
a@gmail.com hard
a@gmail.com soft
b@gmail.com hard
c@gmail.com soft

 As you can see, this table has no unique ID column! E-mails may repeat.

 

I want to sum over the first 2 columns like this.

Email         Hard count   Soft Count
a@gmail.com 1 1
b@gmail.com 1 0
c@gmail.com 0 1

 

I tried group by options but it did not yield good results.

 

Could somebody help me?

 

Thanks!

 

Freelensia

 

1 ACCEPTED SOLUTION
freelensia
Advocate II
Advocate II

I ended up doing this:

 

Let's say you have a table like this:
Site Type
  
You want something equivalent to dragging the Type variable from row to column in Excel's pivot table.
 
How to do it
1. Do a group by Site and Type
You will get a second table like this:
Site Type Count
 
2. Select the Type column, right-click, choose [Pivot Column].
In the next window, choose to Aggregate [Count] column created in previous step. expand [Advanced Options] and choose [Sum]
 
You will get the table you want:

View solution in original post

4 REPLIES 4
freelensia
Advocate II
Advocate II

I ended up doing this:

 

Let's say you have a table like this:
Site Type
  
You want something equivalent to dragging the Type variable from row to column in Excel's pivot table.
 
How to do it
1. Do a group by Site and Type
You will get a second table like this:
Site Type Count
 
2. Select the Type column, right-click, choose [Pivot Column].
In the next window, choose to Aggregate [Count] column created in previous step. expand [Advanced Options] and choose [Sum]
 
You will get the table you want:
Ashish_Mathur
Super User
Super User

Hi,

 

Create a matrix visual.  Drag Email to the row labels, Boune_type to the column labels and write this measure

 

=COUNTROWS(Data)

 

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Anonymous
Not applicable

I think you could do that with 2 measures.   1 for each (hard, soft), the idea would then be to setup an IF statement to populate the field if it is hard or soft.

So a calculation you could do would be 

 

ishard = If(Table1[BounceType] = "hard", 1, null)

issoft = If(Table1[BounceType] = "soft", 1, null)

 last step would just be to count the values 

Thanks for the answer!

 

Sorry but I am completely new to PQ. Could you provide a bit more details on each step?

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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