cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Frequent Visitor

Help with creating table

Hi! I have a table with three columns: Country Office, User, and Completion Status (1 or 0). I also have the measure "Completion Rate", which just takes the average of the Completion Status column and returns the overall completion rate for my users. Based on this information, I want to create a new table with three columns: Country Office, User Count (for the country office), and Completion Rate (for the country office).

 

In excel this would be pretty straighforward with the Countif() function, but could anyone suggest an effective way to do this in Power BI?

 

Below is a screenshot of the table I want:

pic1.JPG

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Solution Sage
Solution Sage

Re: Help with creating table

You can try to use GROUPBY function to get this kind of summary information.

 

NewTableName = GROUPBY('ExistingTableName','ExistingTableName'[Country],"Count of Users",COUNTX(CURRENTGROUP(),'ExistingTableName'[Users]),"Completion Rate", AVERAGEX(CURRENTGROUP(),SUM'ExistingTableName'[Completion Status]/COUNT'ExistingTableName'[Users]))

 

View solution in original post

4 REPLIES 4
Highlighted
Anonymous
Not applicable

Re: Help with creating table

I would create the following three measures:

 

 

[# of Users] = 
    COUNTROWS( table )
[# Complete] = 
    SUM ( table[Completion Status] )

 

 

[% Completion Rate] = 
    DIVIDE( [# Complete], [# of Users] )

Then put table[Country Office] in your table visual, along with these two measures: [# of Users] and [% Completion Rate]

Highlighted
Solution Sage
Solution Sage

Re: Help with creating table

You can try to use GROUPBY function to get this kind of summary information.

 

NewTableName = GROUPBY('ExistingTableName','ExistingTableName'[Country],"Count of Users",COUNTX(CURRENTGROUP(),'ExistingTableName'[Users]),"Completion Rate", AVERAGEX(CURRENTGROUP(),SUM'ExistingTableName'[Completion Status]/COUNT'ExistingTableName'[Users]))

 

View solution in original post

Highlighted
Solution Sage
Solution Sage

Re: Help with creating table

Hi @thomasOfver,

 

To achieve your requirement, I think you can try SUMMARIZE() function. Please refer to following sample:

 

New Table =
SUMMARIZE (
    'Table',
    'Table'[Country Office],
    "Count Of User", COUNT ( 'Table'[Users] ),
    "Completion Rate", DIVIDE (
        SUM ( 'Table'[Completion Status] ),
        COUNT ( 'Table'[Completion Status] )
    )
)

4.PNG

 

Thanks,

Xi Jin.

Highlighted
Frequent Visitor

Re: Help with creating table


@Jessica_Seiyawrote:

You can try to use GROUPBY function to get this kind of summary information.

 

NewTableName = GROUPBY('ExistingTableName','ExistingTableName'[Country],"Count of Users",COUNTX(CURRENTGROUP(),'ExistingTableName'[Users]),"Completion Rate", AVERAGEX(CURRENTGROUP(),SUM'ExistingTableName'[Completion Status]/COUNT'ExistingTableName'[Users]))

 



This totally did the trick - thank you! 🙂

Helpful resources

Announcements
Get Ready for Power BI Dev Camp

Get Ready for Power BI Dev Camp

Mark your calendars and join us for our next Power BI Dev Camp!.

Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Tech Marathon

Maratón de Soluciones de Negocio Microsoft

Una semana de contenido con +100 sesiones educativas, consultorios, +10 workshops Premium, Hackaton, EXPO, Networking Hall y mucho más!

Top Solution Authors
Top Kudoed Authors