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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

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
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Power BI Monthly Update - May 2024

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

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.