Forum Discussion
Calculating fixed salary based on worked days
- 5 years ago
Hi, Anonymous
I am not sure how your data model looks like, but if I assume you created your date-slicer by using the column from Courier Grafic Table, please try the below measure.
Total number of working days in the month =
VAR currentmonth =
MONTH ( MAX ( 'courier grafic'[date] ) )
RETURN
CALCULATE (
COUNTX ( 'courier grafic', 'courier grafic'[time_beg] ),
FILTER (
ALL ( 'courier grafic'[date] ),
MONTH ( 'courier grafic'[date] ) = currentmonth
)
)Hi, My name is Jihwan Kim.
If this post helps, then please consider accept it as the solution to help other members find it faster, and give a big thumbs up.
Hello Power BI Community, I hope this message finds you well. I wanted to reach out and share a situation I'm facing with my data, hoping to get some guidance and insights from this wonderful community. Here's the scenario: I have a dataset that includes a date column ranging from January 1st to June, an employee name column with 320 employee names, an employee status column indicating "Active" or "Inactive," and net salary recorded on the 1st day of each month. The remaining rows for each month are empty for net salary. My goal is to calculate the work days for each employee based on their status, considering only those with an "Active" status. If an employee is marked as "Terminate," they should not be counted as working days. Additionally, I would like to create a new column that calculates the net salary per day for each employee. o tackle this challenge, I have started exploring Power BI and utilizing DAX measures. Here are the measures I have developed: Work Days Count: Work Days Count = CALCULATE( COUNTROWS('YourTable'), 'YourTable'[Employee Status] = "Active", 'YourTable'[Net Salary] <> BLANK(), 'YourTable'[Net Salary Day] <> BLANK() ) Net Salary by Day: Net Salary by Day = IF( 'YourTable'[Employee Status] = "Active", 'YourTable'[Net Salary] / 'YourTable'[Work Days Count], BLANK() ) would greatly appreciate any feedback, suggestions, or alternative approaches from the community. If there are other measures or techniques that can help me achieve accurate work days and net salary calculations, please don't hesitate to share them. Thank you in advance for your support and expertise. I look forward to hearing from you and learning from your valuable insights.
- Ashish_Mathur3 years ago
Super User
Hi,
Share data in a format that can be pasted in an MS Excel file and show the expected result.
- Munawar18813 years ago
Helper II
Expected Result ExampleAttendance Date Attendance Status EmployeeStatus BranchName NetSalary EmpCategory Emp.No ProjectNo Employee No. of Days Daily Salary Per Day01/01/2023 O Active City Lab 25,000 Management 1220078 GP/0001 Muhammad Shahzaib 18 1388.888889 1388.88888902/01/2023 P Active City Lab Management 1220078 GP/0001 Muhammad Shahzaib 175003/01/2023 P Active City Lab Management 1220078 GP/0001 Muhammad Shahzaib 175004/01/2023 P Active City Lab Management 1220078 GP/0001 Muhammad Shahzaib 175005/01/2023 P Active City Lab Management 1220078 GP/0001 Muhammad Shahzaib 175006/01/2023 P Active City Lab Management 1220078 GP/0001 Muhammad Shahzaib 175007/01/2023 O Active City Lab Management 1220078 GP/0001 Muhammad Shahzaib 175008/01/2023 O Active City Lab Management 1220078 GP/0001 Muhammad Shahzaib 175009/01/2023 P Active City Lab Management 1220078 GP/0001 Muhammad Shahzaib 175010/01/2023 P Active City Lab Management 1220078 GP/0001 Muhammad Shahzaib 175011/01/2023 P Active City Lab Management 1220078 GP/0001 Muhammad Shahzaib 175012/01/2023 P Active City Lab Management 1220078 GP/0001 Muhammad Shahzaib 175013/01/2023 P Active City Lab Management 1220078 GP/0001 Muhammad Shahzaib 175014/01/2023 O Active City Lab Management 1220078 GP/0001 Muhammad Shahzaib 175015/01/2023 O Active City Lab Management 1220078 GP/0001 Muhammad Shahzaib 175016/01/2023 P Active City Lab Management 1220078 GP/0001 Muhammad Shahzaib 175017/01/2023 P Active City Lab Management 1220078 GP/0001 Muhammad Shahzaib 175018/01/2023 P Active City Lab Management 1220078 GP/0001 Muhammad Shahzaib 175019/01/2023 P Active City Lab Management 1220078 GP/0001 Muhammad Shahzaib 175020/01/2023 P Active City Lab Management 1220078 GP/0001 Muhammad Shahzaib 175021/01/2023 O Active City Lab Management 1220078 GP/0001 Muhammad Shahzaib 175022/01/2023 O Active City Lab Management 1220078 GP/0001 Muhammad Shahzaib 175023/01/2023 P Active City Lab Management 1220078 GP/0001 Muhammad Shahzaib 175024/01/2023 P Active City Lab Management 1220078 GP/0001 Muhammad Shahzaib 175025/01/2023 P Active City Lab Management 1220078 GP/0001 Muhammad Shahzaib 175026/01/2023 P Active City Lab Management 1220078 GP/0001 Muhammad Shahzaib 175027/01/2023 P Active City Lab Management 1220078 GP/0001 Muhammad Shahzaib 175028/01/2023 O Active City Lab Management 1220078 GP/0001 Muhammad Shahzaib 175029/01/2023 O Active City Lab Management 1220078 GP/0001 Muhammad Shahzaib 175030/01/2023 P Active City Lab Management 1220078 GP/0001 Muhammad Shahzaib 175031/01/2023 P Active City Lab Management 1220078 GP/0001 Muhammad Shahzaib 175001/02/2023 P Active City Lab 35,000 Management 1220078 GP/0001 Muhammad Shahzaib 20 1750 1750