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

Try your skills in the Power BI Dataviz World Championship! Round one ends June 26. Join now

Reply
TestDummy
Regular Visitor

Counting values in multiple columns

I am needing help on how to get the count or total of each different category value from both the "VOC Issue" and "VOC Issue 2" combined. Below is my data and then an example of the results I'm looking for.

2024-03-07_16-28-10.png

Behavior

4
Billing4
Change1
General1
Technology 1
1 ACCEPTED SOLUTION
wdx223_Daniel
Community Champion
Community Champion

=Table.Group(Table.FromColumns({Table.Column(PreviousStepName,"VOC Issue")&Table.Column(PreviousStepName,"VOC Issue 2")},{"VOC Issue"}),"VOC Issue",{"Count",Table.RowCount})

View solution in original post

8 REPLIES 8
wdx223_Daniel
Community Champion
Community Champion

=Table.Group(Table.FromColumns({Table.Column(PreviousStepName,"VOC Issue")&Table.Column(PreviousStepName,"VOC Issue 2")},{"VOC Issue"}),"VOC Issue",{"Count",Table.RowCount})

Thanks for the response, but it still a bit new to this. Could you explain a bit? Also would this be added as "new column" or "new measure"? I tried copying it into both and got errors.

this is a M code, not DAX

dufoq3
Community Champion
Community Champion

Hi, @wdx223_Daniel provided Power Query solution - so you should add his code as a new step in your Power Query query.

 

dufoq3_0-1713085382913.png


Note: Check this link to learn how to use my query.
Check this link if you don't know how to provide sample data.

=Table.Group(Table.FromColumns({Table.Column(PreviousStepName,"VOC Issue")&Table.Column(PreviousStepName,"VOC Issue 2")},{"VOC Issue"}),"VOC Issue",{"Count",Table.RowCount})

The above provided code has PreviousStepName two times, you have to replace both with last step of your query. Just start writing name of last step of your existing query, like in attached image below, started writing changed Type and it will auto detect the name in proper format, select that for both the instances. 

 

mahenkj2_0-1713503939801.png

 

Hope it helps.

I did that and now I get an expression error of 'PreviouseStepName' not recognized.

dufoq3
Community Champion
Community Champion

You have to replace 'PreviousStepName' with your previous step reference.


Note: Check this link to learn how to use my query.
Check this link if you don't know how to provide sample data.

I don't know what that is/means. Like I said I am still fairly new this. Could you explain a bit?

Helpful resources

Announcements
Fabric Data Days is here Carousel

Fabric Data Days 2026

Don't miss out on Data Days, June 15 through August 7. Learn Fabric, Power BI, SQL, AI and more.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.