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
Mateja
Helper II
Helper II

Calculating frequency for EVERY MONTH, where values are present only in some months

Hi 

I am hoping you can help me!

I am working on a HSE Dashboard and need to make a graph showing frequencies of LTA (Lost time accidents) for every month 

The formula to calculate LTA is   = Divide(SUM(_LTA[Count])*1000000, Hours[AllHours])

So to calculcate a value of LTAFreq for a certain month, one looks at last 12 months - sums the count of LTAs*1000000 and sums all working hours. Dividing that will give frequency.

Formula works fine, the values are as they should be, but only for the last month/current month 

 

Because there are mssing values in certain month in regards to count of LTAs it will calculate frequencies only for those months.

How can I force power bi to make calulations of frequencies for every month, not just those whwere LTAs appear.

This problem is easily solveable in excel because I appiying the mentioned formula to every cell in frequency column will automaticaly calculate it for evey month (LTA frequencies in mock table were calculated in excel)

 

Of course because the of limited data I mostly want frequencies for months of 2022

My LTAs are stored in master Excel in tabluar view where every line is one report with occurence date and other info.

Working hours are pulled from our SQL server.

They are not in the same table. 

 

I realy hope you can help me because I do not have enough experience with DAX to find a solution!

Thank you!

 

Mock data for the issue with last column being the values I want  :

DateWorking hoursLTA LTAFreq I want! 
2021-01-011478541 
2021-02-01197966  
2021-03-01197029  
2021-04-01136530  
2021-05-01193221  
2021-06-01163444  
2021-07-01143231  
2021-08-01182706  
2021-09-011625361 
2021-10-01199410  
2021-11-01143552  
2021-12-01135489 1,00
2022-01-01150896 0,50
2022-02-0114388611,02
2022-03-01140970 1,05
2022-04-01150705 1,05
2022-05-01170472 11,59
2022-06-01138908 1,61
2022-07-01159559 1,60
2022-08-01158142 1,62
2022-09-01149305 1,09
2022-10-01153351 1,11
2022-11-01135956 1,12
2022-12-01192944 1,08
1 ACCEPTED SOLUTION
v-yalanwu-msft
Community Support
Community Support

Hi, @Mateja ;

I am not very clear about your logic and how to get the desired output. You mentioned that Excel can achieve the result, right? Can you share Excel and its formulas?

If the above one can't help you get the desired result, please provide some sample data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community. Thank you.

How to upload PBI in Community


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

View solution in original post

2 REPLIES 2
v-yalanwu-msft
Community Support
Community Support

Hi, @Mateja ;

I am not very clear about your logic and how to get the desired output. You mentioned that Excel can achieve the result, right? Can you share Excel and its formulas?

If the above one can't help you get the desired result, please provide some sample data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community. Thank you.

How to upload PBI in Community


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

HI 

 

Thank you for taking time to respond.

I found the poblem in my date calendar that prevented me from using the function Datesinperiod. Once I removed the mistake, I was able to use this function to get calculations for every month. 

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.