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

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

Reply
MELO85
Frequent Visitor

Calculate % of total Incident that were reported within 48 hours

Hi,

 

I need help in calculating the % of incidents reported within 48 hours .

My data looks like this :

 

datadata

I want my final result to be showing by country and by month the incident that were reported within 48 hours.

 

Please let me know if you need any more details

1 ACCEPTED SOLUTION

Hi @MELO85 

Thanks for reaching out to us.

You can try this, create the measures below,

hourdiff = DATEDIFF( MIN('Table'[reported date]),MIN('Table'[incident date]),HOUR)
# of incidents = CALCULATE(COUNTROWS('Table'),ALLEXCEPT('Table','Table'[country id]))
# of incidents that were reported during 48 hours = CALCULATE(COUNTROWS('Table'),FILTER('Table',[hourdiff]<=48))
% of incidents that were reported during 48 = DIVIDE([# of incidents that were reported during 48 hours],[# of incidents])

vxiaotang_0-1655193334238.png

 

Best Regards,

Community Support Team _Tang

If this post helps, please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

5 REPLIES 5
danextian
Super User
Super User

Hi @MELO85 ,

 

Please post a sample data? And if you say within 48 hours, what is that based on? Dataset refresh time?





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

Hello,

 

Thank you so much for your reply.

 

Within 48 hours means the date diff between incident report date and created on dates.

 

Here's a sample data 

crc05_country_idcrc05_genderinvolvedcrc05_incidentdatecrc05_incidentdatereported
2070Woman5/15/2022 0:006/9/2022 12:56
2037Woman6/6/2022 0:006/6/2022 19:49
2037Man6/8/2022 0:006/8/2022 15:04
2016Man6/6/2022 0:006/8/2022 14:46
2070Man5/3/2022 0:006/8/2022 11:01
2017Woman5/24/2022 0:006/6/2022 9:33
2037Woman5/24/2022 0:006/5/2022 23:15
2041Woman5/19/2022 0:006/5/2022 21:33
2037Man6/4/2022 0:006/5/2022 20:51
2014Man5/24/2022 0:006/5/2022 12:07
2049Woman6/1/2022 0:006/3/2022 17:28
2038Woman,Man5/23/2022 0:005/24/2022 14:06
2034No personnel were impacted5/18/2022 0:005/24/2022 14:03
2014Woman5/24/2022 0:006/1/2022 17:32
2037Woman,Man5/24/2022 0:005/24/2022 14:04

Hi @MELO85 

Thanks for reaching out to us.

You can try this, create the measures below,

hourdiff = DATEDIFF( MIN('Table'[reported date]),MIN('Table'[incident date]),HOUR)
# of incidents = CALCULATE(COUNTROWS('Table'),ALLEXCEPT('Table','Table'[country id]))
# of incidents that were reported during 48 hours = CALCULATE(COUNTROWS('Table'),FILTER('Table',[hourdiff]<=48))
% of incidents that were reported during 48 = DIVIDE([# of incidents that were reported during 48 hours],[# of incidents])

vxiaotang_0-1655193334238.png

 

Best Regards,

Community Support Team _Tang

If this post helps, please consider Accept it as the solution to help the other members find it more quickly.

Hi @MELO85 ,

 

Id first create a calculated column compute the difference between the two datetime columns and then use that count how many incidents are within 48 hours.

 

calc column

 

Time Difference = 
DATEDIFF (
    'Table'[crc05_incidentdate],
    'Table'[crc05_incidentdatereported],
    HOUR
)

 

measure

 

Incidents within 48 hours = 
CALCULATE (
    COUNTROWS ( 'Table' ),
    FILTER ( 'Table', 'Table'[Time Difference] <= 48 )
)

 


sample PBIX - https://drive.google.com/file/d/1r0uc0bzbyqe8-GCVG2Qbb4DfvLxCjUzj/view?usp=sharing 





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

Thank you so much for your reply. This helps a lot.

 

I need the % of these incidents that happened during 48 hours out of the total by country.

 

Can I add the Countrows function by country . Do you have any idea how I can add that?

country id # of incidents# of incidents that were reported during 48 hours% of incidents that were reported during 48 hours
country 16233.33%
country 25120.00%
country 34125.00%

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

February Power BI Update Carousel

Power BI Monthly Update - February 2026

Check out the February 2026 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.