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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
fabd
Helper I
Helper I

How to group by ?

Hi,

sorry for this basic question. I hang around the community before posting. I found some help, but i was not able to implement these advice in my case.

 

So, i have a following table :

 

pbigroup.png

I would like to generate a report like this one :

Model , datemonth, CPU, Frequency, RAM

group by model, datemonth, CPU, Frequency, RAM with count of unique model

ie :

Proliant ML350GEN10,      2020-2-11   Intel,  ,2500    ,  512   , 4

Proliant ML350GEN10,      2020-3-14   Intel,  ,2500    ,  512   , 1

 

I tryed to use SUMMARIZE function with no luck.

 

I have the following error :

The expression refers to multiple columns. Multiple columns cannot be converted to a scalar value.

 

if i put 1 element, several are required, and if i put several, another error ...

 

Can you give me some advice ?

1 ACCEPTED SOLUTION

Hello @fabd ,

I'm sorry for my mistake. Please try the formula below.

Table 2 = 
SELECTCOLUMNS (
    'Table',
    "Model", 'Table'[Model],
    "DateMonth", 'Table'[datemonth],
    "CPU", 'Table'[CPU],
    "Frequency", 'Table'[Frequency],
    "RAM", 'Table'[RAM],
    "DistinctCount", CALCULATE (
        DISTINCTCOUNT ( 'Table'[Model] ),
        ALLEXCEPT ( 'Table', 'Table'[datemonth] )
    )
)

3.PNG

I changed the sample data. For more information, see the attachment.

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

View solution in original post

9 REPLIES 9
v-xuding-msft
Community Support
Community Support

Hi @fabd ,

Do you want to create a new table? If so, you could try like this:

Table 2 =
SELECTCOLUMNS (
    'Table',
    "Model", 'Table'[Model],
    "DateMonth", 'Table'[datemonth],
    "CPU", 'Table'[CPU],
    "Frequency", 'Table'[Frequency],
    "RAM", 'Table'[RAM]
)

2.PNG

 

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

Hello Xue,

 

How do you make a group by to count number of Model for each year/month ?

Hello @fabd ,

I'm sorry for my mistake. Please try the formula below.

Table 2 = 
SELECTCOLUMNS (
    'Table',
    "Model", 'Table'[Model],
    "DateMonth", 'Table'[datemonth],
    "CPU", 'Table'[CPU],
    "Frequency", 'Table'[Frequency],
    "RAM", 'Table'[RAM],
    "DistinctCount", CALCULATE (
        DISTINCTCOUNT ( 'Table'[Model] ),
        ALLEXCEPT ( 'Table', 'Table'[datemonth] )
    )
)

3.PNG

I changed the sample data. For more information, see the attachment.

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

thanks xue, i am going to try

Hi again,

 

Thanks for the quick tutorial for working with a new table.

 

I successed to do what i want. Thanks all of you for your help result.png!

 

 

Hi @fabd ,

Glad you have resolved it.🙂 Can you please share your formula and accept it as a solution? More people who have the same requirement will benefit here.

 

 

Best Regards,
Xue Ding
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
amitchandak
Super User
Super User

@fabd , Can you share the summarize you have used.

 

What is left for Distinct count after selecting model

summarize(Table, Table[model], Table[datemonth], Table[CPU], Table[Frequency], Table[RAM] ,"Unique Model", distinctCOUNT(Table[Name]))

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

Hello guys,

 

Following your advice, here is the result with the summarize()

scalar.png

 

For the matrix, this is only what i successed to do

 

matrix.png

 

I would like something like this in a simple table that i could export to csv after :

 

serverModelName,manufacturer,numCpus,cpuType,cpuGhz,memGb,numberOfServers,dateOfPurchase,pricePerServer,
batchType,dataCenterName

VijayP
Super User
Super User

Just Try Creating MAtix Table use rows and Columns to accomodate fields and let me know if any issue and paste the snapshot to see what else you require.

If this is an answer then you can mention this as an answer and share your Kudoes

Regards

Vijay Perepa

you can watch my Videos on www.youtube.com/perepavijay




Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
MY Blog || My YouTube Channel || Connect with me on Linkedin || My Latest Data Story - Ageing Analysis

Proud to be a Super User!


Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.