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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

calculating percentage after grouping

Hi, 

 

I am new to power BI and trying it out with a covid-19 dataset. 

 

I want to calculate the number of cases as a percentage of the total population. But first I need to calculate the total number of cases by region.

My data looks like the following: 

 

DateCasesDeathsCountry CodePopulation Data
08/04/20201022GBR

66488991

07/04/20204310GBR

66488991

06/04/2020712GBR

66488991

08/04/2020167USA

327167343

07/04/202096USA

327167343

06/04/2020299USA

327167343

 
5 REPLIES 5

Hi @Anonymous ,

 

I would split the data into two tables.

 

Table: Cases

- Date

- Cases

- Death

- Country Code

 

Table: Country

- Country Code

- Populatoin Data

 

            n:1

Cases <---- Country

 

Did I answer your question?
Please mark my post as solution, this will also help others.
Please give Kudos for support.

Marcus Wegener works as Full Stack Power BI Engineer at BI or DIE.
His mission is clear: "Get the most out of data, with Power BI."
twitter - LinkedIn - YouTube - website - podcast


Hi @Anonymous ,

 

Quick and Dirty

Measure = DIVIDE(SUM('Table'[Cases]),AVERAGE('Table'[Population Data]))

 

Did I answer your question?
Please mark my post as solution, this will also help others.
Please give Kudos for support.

Marcus Wegener works as Full Stack Power BI Engineer at BI or DIE.
His mission is clear: "Get the most out of data, with Power BI."
twitter - LinkedIn - YouTube - website - podcast


Anonymous
Not applicable

Hi @mwegener 

 

Thanks for your help! 

 

I however didn't mention that first I need to sum the cases by country. Is there a way to group rows? 

 

thanks 

Hi @Anonymous ,

 

Sorry for that, but we cannot understand your requirment clearly, Could you please show the exact expected result based on the tables that you have shared? Do you want to show the result in the table visual?


Best regards,

 

Community Support Team _ Dong Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi @Anonymous ,

 

what do you want to group?

A grouping is usually done via query by the visual?

 

Did I answer your question?
Please mark my post as solution, this will also help others.
Please give Kudos for support.

Marcus Wegener works as Full Stack Power BI Engineer at BI or DIE.
His mission is clear: "Get the most out of data, with Power BI."
twitter - LinkedIn - YouTube - website - podcast


Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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