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
PooBIDeveloper
Frequent Visitor

Unable to use group by for multiple columns

Hi All,

 

I have a table with my comments  and months columns.

 

i want each month column should be grouped based on there comments.

i have used groupby but its applied for one column only ie aug,when i am using the same groupby dax for the other column its showing error table of multiple values.

can any one please help .

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi  @PooBIDeveloper ,

Here are the steps you can follow:

1. Enter the power query, select the column with month identification, such as [17Aug21], [5Jun21], [6Sep21], click Transform – Unpivot Columns.

vyangliumsft_0-1640676302802.png

Result:

vyangliumsft_1-1640676302804.png

2. Create measure.

Count_Measure =
CALCULATE(COUNT('SampleTable'[Value]),FILTER(ALL('SampleTable'),'SampleTable'[Value]=MAX('SampleTable'[Value])&&'SampleTable'[Attribute]=MAX('SampleTable'[Attribute])))

3. Result:

vyangliumsft_2-1640676302807.png

 

Best Regards,

Liu Yang

View solution in original post

11 REPLIES 11
Anonymous
Not applicable

Hi  @PooBIDeveloper ,

Here are the steps you can follow:

1. Enter the power query, select the column with month identification, such as [17Aug21], [5Jun21], [6Sep21], click Transform – Unpivot Columns.

vyangliumsft_0-1640676302802.png

Result:

vyangliumsft_1-1640676302804.png

2. Create measure.

Count_Measure =
CALCULATE(COUNT('SampleTable'[Value]),FILTER(ALL('SampleTable'),'SampleTable'[Value]=MAX('SampleTable'[Value])&&'SampleTable'[Attribute]=MAX('SampleTable'[Attribute])))

3. Result:

vyangliumsft_2-1640676302807.png

 

Best Regards,

Liu Yang

Hi Liu Yang it works..thanks a lot...

but  that horizontally total is not showing correctly...

PooBIDeveloper
Frequent Visitor

Hi v-yangliu-msft ,

Thanks for your revert

i dont have any date column ,or table below is the sample of the excel from that i have to group the commnets which are in aug,mar and june.

 

PooBIDeveloper_0-1640157001716.png

 

 

from above excel i have to make belor report

 

PooBIDeveloper_1-1640157084273.png

 

i have achived this but for only column ie aug , but unable to do the same for the other columns

Group_Comments_aug =
GROUPBY(Query1,Query1[17Aug21],"#_AUg",COUNTX(CURRENTGROUP(),1))
i got the below output for one column ie AUg only.
PooBIDeveloper_2-1640157270944.png

 

 

Anonymous
Not applicable

Hi  @PooBIDeveloper ,

I created some data:

vyangliumsft_0-1640135690647.png

Here are the steps you can follow:

1. Create measure.

count_group =
COUNTX(FILTER(ALL('Table'),'Table'[comments]=MAX('Table'[comments])&&MONTH('Table'[Date])=MONTH(MAX('Table'[Date]))),[comments])
hasonevalue =
var _table=SUMMARIZE('Table', 'Table'[comments] ,"__value", [count_group])
RETURN
IF(HASONEVALUE('Table'[comments]),[count_group],SUMX(_table,[__value]))

2. Put it into the matrix

vyangliumsft_1-1640135690650.png

3. Result:

vyangliumsft_2-1640135690652.png

 

Best Regards,

Liu Yang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

PooBIDeveloper
Frequent Visitor

Hii..

any suggestions??

PooBIDeveloper
Frequent Visitor

if i am using same dax with other column nmae it shows error table of multiple value

amitchandak
Super User
Super User

@PooBIDeveloper , Try to group comments like this

 

concatenatex(Table, Table[Comments], ",")

 

or

 

Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

 

thanks for ur repy.

below is the sample for the same

 

PooBIDeveloper_1-1639722974355.png

 

 

@PooBIDeveloper , the sample is not making the issue clear. Can you explain

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

ok

I have an excel sheet which have customer names,sales,state,region etc.

in that sheet i have every column name such as 17Aug21,13 jun21,10mar21 and this month column name will be added every month.

in month column name(17Aug21,13june21) i have data such as CANNOT BE APPLIED,CONFIRMATION PENDING:-CUSTOMER AND SP ,CUSTOMER HAS TO ACCEPT THE LINK etc bases on the customer name

so basically i want the count of the comments of every month ie if i select the column 17aug21 in this column if i select value CANNOT BE APPLIED, it will show the values CANNOT BE APPLIED, and i want the count of this value.say its is repeated 10 times for in 17Aug21 .

so             comments                 17aug21  mar21  aug21

              CANNOT BE APPLIED,  10            12          44

             

i am looking to make the above table.

i have used 

Group_Comments_aug =
GROUPBY(Query1,Query1[17Aug21],"#_AUg",COUNTX(CURRENTGROUP(),1)) which only count the comment of a single column
thanks..

 

any suggestions....

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