cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper III
Helper III

Create a new table that counts the amount of times a certain combination of 2 columns occurs

Whats up, powerBI wizards,

 

I have a seemingly easy question but I honestly can't figure it out. Below I have illustrated my problem in excel to show you what I'm trying to achieve:

 

The left table is what my source table looks like. The right table is a table that I am trying to create. It's purpose is to count the amount of times a certain combination of period and label happens. 

 

Thanks!

image.png

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 
1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Super User VI
Super User VI

Re: Create a new table that counts the amount of times a certain combination of 2 columns occurs

Hi @ErikBI 

create a new calculated table

Table = SUMMARIZE(Table, Table[period], Table[label], "COUNT", Countrows(Table))

do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

View solution in original post

6 REPLIES 6
Highlighted
Super User VI
Super User VI

Re: Create a new table that counts the amount of times a certain combination of 2 columns occurs

Hi @ErikBI 

create a new calculated table

Table = SUMMARIZE(Table, Table[period], Table[label], "COUNT", Countrows(Table))

do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

View solution in original post

Highlighted
Super User IX
Super User IX

Re: Create a new table that counts the amount of times a certain combination of 2 columns occurs

If you take count of the label in visualization that should also do.

 

count =count(table[label])



Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
My Recent Blog -Week is not so Weak Connect on Linkedin

Proud to be a Super User!

Highlighted
Super User IX
Super User IX

Re: Create a new table that counts the amount of times a certain combination of 2 columns occurs

@ErikBI ,Does the above replies helped. if you need more help make me @

Appreciate your Kudos.



Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
My Recent Blog -Week is not so Weak Connect on Linkedin

Proud to be a Super User!

Highlighted
Helper III
Helper III

Re: Create a new table that counts the amount of times a certain combination of 2 columns occurs

Hey @az38 , thanks for your reply. This does exactly what I needed!

 

I have one more question: I would like to join (append) this table to an existing table. But since this table is not created in the query editor, I can't append it. Do you know how I can append this newly created table to an existing table?

 

Thanks!

 

Newly created table with your code:

bi2.PNG

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

My existing table

bi1.PNG

Highlighted
Super User VI
Super User VI

Re: Create a new table that counts the amount of times a certain combination of 2 columns occurs

@ErikBI 

for append tables after creating Power Query transformation use DAX UNION() function.

create a new calculated column like

New Table = UNION(Table1, Table2)

 but be carefull there are some rules from here https://docs.microsoft.com/en-us/dax/union-function-dax

The two tables must have the same number of columns.
Columns are combined by position in their respective tables.
The column names in the return table will match the column names in table_expression1

do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

Highlighted
Helper III
Helper III

Re: Create a new table that counts the amount of times a certain combination of 2 columns occurs

You're a legend. A lifesaver. Thanks so much! 😁

Helpful resources

Announcements
Meet the 2020 Season 2 Power BI Super Users!

Meet the 2020 Season 2 Power BI Super Users!

Find out who's part of the program this season, and welcome the new Super Users.

August 2020 Community Challenge: Can You Solve These?

August 2020 Community Challenge: Can You Solve These?

We're excited to announce our first cross-community 'Can You Solve These?' challenge!

July 2020 Community Highlights

July 2020 Community Highlights

Learn about the exciting things that happened in July.

Featured Data Story of The Month

Featured Data Story of The Month

All Data Stories Gallery contributions are reviewed for each month. We select a contribution and feature the community member the following month.

Power BI Dev Camp - Developing with .NET Core

Power BI Dev Camp - Developing with .NET Core

Learn how to develop custom web applications for Power BI using .NET Core 3.1 and .NET 5.

Top Solution Authors
Top Kudoed Authors