Calculate daily increase/decrease in COVID-19 cases / deaths - excel

I was trying to plot some reports for Covid-19 cases around the Globe, using Excel and Power BI. With Power BI is easier and fancier to do definitely, but I need an Excel file or calculation that makes sense - similar to the PBI. What I actually wanted is to calculate the daily increase in new cases (with %) and also death rate but per day, or total death by day and so on..
I did some calculations (% of column total and I calculated one field to get death rate%) here using Pivot tables but not sure how to do daily increase/decrease? Did anyone get an idea for additional calculations?
This is copied from PBI (calculations) which I wanna have similar in Excel - but I am not sure If I can calculate it properly (last 2 pictures).
The data source from the input data is here:
https://www.ecdc.europa.eu/sites/default/files/documents/COVID-19-geographic-disbtribution-worldwide.xlsx

You need an extra column for the result you want (e.g. daily increase/decrease), then you can plot either the waterfall chart, or using techniques similar to
https://www.extendoffice.com/documents/excel/5945-excel-chart-display-percentage-change.html

Related

How to properly calculate Basketball team percent averages?

So I was making a dashboard for a personal project and I put some stats on a spreadsheet and made a column that calculated FG% based on (Field Goals Made/Field Goals Attempted) for each player. Now I threw this into Power BI and I want to calculate the team FG% average but Power BI takes the percentages as they are and averages them by taking all the percentages, adding them, and dividing by # of values. Of course, this is the normal way to find the average for General numbers but not percentages. How do I fix this and get the actual average FG%?
I apologize, I'm very new to this. Stats,PowerBI Avg. Calculation
For reference, this is the chart I'm trying to make inPowerBI chart

Excel: Sum of Total Population per Continent (using Excel formulas - without Pivot)

I was playing a bit with the data of nowadays topic: Covid-19 and I downloaded some data to do some Analytics from:
https://www.ecdc.europa.eu/sites/default/files/documents/COVID-19-geographic-disbtribution-worldwide.xlsx
And this is what I managed to do using Power Query and Pivot tables:
From this data here - it is just a small piece of huge dataset:
Pivot tables are great and you can do a lot of things as you can see, BUT, what I wanted to do is do calculations (sum per Continent with excel formulas for the Total Population per Continent. There in the data set is lot of countries with certain Population and I am not managing the right way using =max/if/sumif. I just wanna know this way for myself!
I am sure that ain't that hard but I am now bit out of logic =)
I hope you got the point!!
First Edit:
=sumif doesn't work at the first place, because you have repetitive Population per one Country per day...it is summing the same land with its population per day - not what I need but only 1x the general sum of population.

How To Convert The Grand Total of a Pivot Table as a Value for Each Row in a New Column

Overall goal for my report:
I am creating a pivot table in excel right now (eventually in Power Bi) that will update daily through data imports to reflect weekly changes in sales. I am then trying to perform a Z score analysis on each week to see if there are any outliers within the data.
What I will need to do is be able to subtract a mean of all of the data from each weekly set of sales, then divide it by the standard deviation.
Current thought process for data:
If I can get the grand total at the bottom, could I get that as a value entered for each row in another column? Can I do it as a total average and a total standard deviation? I can do it outside of a pivot table, but I want something in a pivot table so it auto-populates.
Current Data
Desired Data
You can tackle this in at least two approaches:
Dynamic calculation using measures
Back-end calculation
The first approach consists of defining measures in the following context:
CALCULATE([MEASURES], All('Calendar'), VALUES('Calendar'[Year]), VALUES('Calendar'[Month]))
This allows you to calculate a measure in a context that consider the entire month. Therefore, for each day you would have a measure that gives you the stdev of the entire month.
Pro: dynamic; fast to implement; can be based on measures already defined
Cons: more calculation in front-end slows down your report
The second approach consists of pre-calculating this values in the back-end. Here you have two possible approaches:
Data source: add these new columns in the data source (e.g. Database)
Pro: best-practices and clean approach
Cons: static; cannot use measures already defined
Calculated Column in DAX: define the value as a Calculated Column in the back-end of Power BI using the same structured defined for the Measure:
CALCULATE([MEASURES], All('Calendar'), VALUES('Calendar'[Year]), VALUES('Calendar'[Month]))
Pro: fast to implement
Cons: static; really against best-practices
In Power BI I used following measures (replace 'stack' with 'your table name')
Total StdDev = CALCULATE(STDEV.P(stack[sum of sales]), ALL(stack))
TotalMean = CALCULATE(AVERAGE(stack[sum of sales]),ALL(stack))
Z score = (SUM(stack[sum of sales]) - [TotalMean])/[Total StdDev]
I used average to calculate MEAN and I get different result to yours (please see below).
If you can share formula that you used to calculate 'TotalMean' maybe I can update it.

Dynamic Percentile Analysis Across Multiple Categories - PowerPivot / DAX

I've spent a a lot of time trying to find a solution to the following issue but I haven't been able. There are similar threads to this issue both here and on other forums but they don't seem to be applicable. Please let me know any best demonstrated practices regarding posting on this forum that I may be going against.
I would like to be able to dynamically (and hopefully in as simple way as possible) create measures (ideally NOT via calculated columns) in power pivot to be able to carry out percentile analysis (e.g., value associated with top quartile, top quintile, third decile, etc etc) on different subsets of my data (in a pivot table). For example, I might want to create the percentile based on the yearly sales associated with a shop (although the records I have are based on monthly, or another time period).
Here is what this data could look like as an example, as well as what the results would be on this data (I did this jammily using excel). I know that there is a way to do this using calculated columns but I want to try and do it using measures (e.g., maybe using a combination of sumx, percentiles, top n??).
In case you're not able to view the picture of my data, my data is structured as such:
===============================================================================================
**Shop ID** ## **Value** ## **Metric**## **Period** (e.g., mm / yy) ## **Franchised or Co Owned** ## **Year** ## **Quarter**
===============================================================================================
1 50 etc etc please see screenshot! thank you
2 70
3 90
Additional explanation on data
Shop ID could have many entries
Value is the value for each metric - the record is based around having a value for each metric for each shop id for each month (or other time period)
Metric could be things like sales, ebitda, car count, etc etc
Period is typically month
Shop status could be "Co - Owned" or "Franchised"
Year and Quarter are based off the period
I want to be able to get percentile values for sales in a given period (e.g., total yearly sales for a given year, total quarterly sales etc) for whatever slicer i have going on for the current pivot table.
Super grateful for any help!
Thanks,
Louis
OK, I think I found an answer. Something like this formula might work:
PERCENTILEX.INC(ALLSELECTED(Facts[ID]),SUMX(ALLSELECTED(Facts[Period]),[Sum Values]),[Percentile Definition])

Converting Hourly Data to Daily Data for many different Excel files

I have been downloading and organizing hourly water quality data into Excel for many different states, and have organized them by year. I have done data prep for them to make sure there are no zeros/every day of the year (DOY) has 24 values, but the time series plots were too noisy so want me to get the daily average values instead.
All of the sites annual data is different in terms of how many days are available, and sometimes they are missing whole months due to no recordings.
So my question is, how can I develop a code to give me the average daily value linked to a specific DOY that I can apply to many different Excel sheets. The data appears like this:
And the files are saved like like CA1_2012 (California Site 1 hourly data from 2012)
I know there is a lot on this topic but I have been trying everything and I can't get a code that works!
You can get the summation of the second column based on values in the first column in matlab using accumarray;
[m,~,n] = unique(data(:,1));
sumdata = [m, accumarray(n,data(:,2))];
for mean I would suggest grpstats:
avgdata = grpstats(data, DOY, {'mean'});
or as #gnovice suggested:
avgdata = accumarray(DOY, data, [], #mean);
You can also get what you want by using Pivot Table in excel and group data by DOY and get the mean value for them in the table. (No coding required).

Resources