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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

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]))

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
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

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