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

Calculate the Pertectage of the current Coronavirus

Hey guys for the current corona virus i have built a webscraper and get the following raw data.

I would like to calculate the "Death rate" in power bi by using a formula or something else.

My Idea is (only for China please)

Death rate: 100 / confirmed cases (7 days before the latest update) * Deaths from the current update.

or in Raw data

Death rate: 100 / 834,26 (01-24-2020,18:06,China) * 259 (02-01-2020,02:02,China)

 

I get an Update multiply times a day. So we need to focusing on Date (02-01-2020 - 7 Days = 01-24-2020)

 

Hope you can help me with an formular

Thanks Guys.

 

02-01-2020,00:36,Cambodia,1,0
02-01-2020,00:36,Finland,1,0
02-01-2020,00:36,India,1,0
02-01-2020,00:36,Nepal,1,0
02-01-2020,00:36,Philippines,1,0
02-01-2020,00:36,Spain,1,0
02-01-2020,00:36,Sri Lanka,1,0
02-01-2020,00:36,Sweden,1,0
02-01-2020,02:02,China (mainland),11821,259
 

 

2 REPLIES 2
v-alq-msft
Community Support
Community Support

Hi, @Anonymous 

 

Typically, your data model will contain a calendar table. In fact, it is usually better to aggregate data by year and month using columns of a calendar table (containing one row for each day) instead of  extracting the date parts from a single column of type date or datetime in calculated columns.

 

For further information, you may refer to the following links.

https://community.powerbi.com/t5/Desktop/FIltering-table-on-relative-date/m-p/852765

https://community.powerbi.com/t5/Desktop/Dynamic-Relative-Date-Filtering/m-p/553762

 

Best Regards

Allan

 

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

You can use relative date slicer : https://docs.microsoft.com/en-us/power-bi/visuals/desktop-slicer-filter-date-range

 

Or you can use a rolling 7 day measure. example

Rolling 7 = CALCULATE(sum(Sales[Sales Amount]),DATESINPERIOD('Date'[Date],maxx(sales,Sales[Sales Date]),-7,DAY))   

 

In both case prefer a date calendar table.

To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s.

Refer
https://radacad.com/creating-calendar-table-in-power-bi-using-dax-functions
https://www.archerpoint.com/blog/Posts/creating-date-table-power-bi

https://www.sqlbi.com/articles/creating-a-simple-date-table-in-dax/

Appreciate your Kudos. In case, this is the solution you are looking for, mark it as the Solution. In case it does not help, please provide additional information and mark me with @
Thanks. My Recent Blog -
Winner-Topper-on-Map-How-to-Color-States-on-a-Map-with-Winners , HR-Analytics-Active-Employee-Hire-and-Termination-trend
Power-BI-Working-with-Non-Standard-Time-Periods And Comparing-Data-Across-Date-Ranges

Connect on Linkedin

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.