Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
hello, i have this powerbi dahsboard and all the details below:
I have 2 tables:
attendance table:
Id | Name | Date | Clock in | Clock Out | Absent |
1 | Lebron | 6/1/2022 | 00:00:00 | 00:00 | TRUE |
1 | Lebron | 6/2/2022 | 07:00 | 15:00 | Present |
1 | Lebron | 6/3/2022 | 07:00 | 15:00 | Present |
1 | Lebron | 6/4/2022 | 07:00 | 15:00 | Present |
1 | Lebron | 7/3/2022 | 07:00 | 15:00 | Present |
1 | Lebron | 7/4/2022 | 07:00 | 15:00 | Present |
1 | Lebron | 7/5/2022 | 07:00 | 15:00 | Present |
1 | Lebron | 7/6/2022 | 07:00 | 15:00 | Present |
1 | Lebron | 8/1/2022 | 07:00 | 15:00 | Present |
1 | Lebron | 8/2/2022 | 07:00 | 15:00 | Present |
1 | Lebron | 8/3/2022 | 07:00 | 15:00 | Present |
1 | Lebron | 8/4/2022 | 07:00 | 15:00 | Present |
2 | Ari | 6/1/2022 | 07:00 | 15:00 | Present |
2 | Ari | 6/2/2022 | 07:00 | 15:00 | Present |
2 | Ari | 6/3/2022 | 07:00 | 15:00 | Present |
2 | Ari | 6/4/2022 | 07:00 | 15:00 | Present |
2 | Ari | 7/3/2022 | 07:00 | 15:00 | Present |
2 | Ari | 7/4/2022 | 00:00:00 | 00:00 | TRUE |
2 | Ari | 7/5/2022 | 00:00:00 | 00:00 | TRUE |
2 | Ari | 7/6/2022 | 07:00 | 15:00 | Present |
2 | Ari | 8/1/2022 | 07:00 | 15:00 | Present |
2 | Ari | 8/2/2022 | 07:00 | 15:00 | Present |
2 | Ari | 8/3/2022 | 07:00 | 15:00 | Present |
2 | Ari | 8/4/2022 | 07:00 | 15:00 | Present |
and employee table:
Id | Name | Date | Payment per hour | Total days worked |
1 | Lebron | 6/1/2022 | 1 | 3 |
1 | Lebron | 7/1/2022 | 1.25 | 4 |
1 | Lebron | 8/1/2022 | 1.75 | 4 |
2 | Ari | 6/1/2022 | 2 | 4 |
2 | Ari | 7/1/2022 | 2.5 | 2 |
2 | Ari | 8/1/2022 | 2.5 | 4 |
i want to find value of payment per hour each month.
so if i put the month of august, when i press on ari, i get 2.5, while lebron 1.75
if i put month of june, if i press on ari, o get 2, while if i press lebron i get 1
@SpartaBI @amitchandak @tamerj1
Solved! Go to Solution.
Hi @Anonymous
Actually the solution I provided in your previous post shall work fine with no issues. The reason is when the employee is absent then his time is already zero and no need to make any further filtering.
https://www.dropbox.com/t/l7mnejNnTkgNaqr3
Monthly Salary Measure =
SUMX (
employee,
VAR CurrentRate = employee[Payment per hour]
VAR CurrentMonth = MONTH ( employee[Date] )
VAR CurrentYear = YEAR ( employee[Date] )
RETURN
SUMX (
FILTER (
RELATEDTABLE ( attendance ),
MONTH ( attendance[Date] ) = CurrentMonth
&& YEAR ( attendance[Date] ) = CurrentYear
&& attendance[Absent] = "Present"
),
VAR Clockin = attendance[Clock in]
VAR Clockout = attendance[Clock Out]
VAR NumberOfHours = DATEDIFF ( Clockin, Clockout, HOUR )
RETURN
CurrentRate * NumberOfHours
)
)
Hi @Anonymous
Actually the solution I provided in your previous post shall work fine with no issues. The reason is when the employee is absent then his time is already zero and no need to make any further filtering.
https://www.dropbox.com/t/l7mnejNnTkgNaqr3
Monthly Salary Measure =
SUMX (
employee,
VAR CurrentRate = employee[Payment per hour]
VAR CurrentMonth = MONTH ( employee[Date] )
VAR CurrentYear = YEAR ( employee[Date] )
RETURN
SUMX (
FILTER (
RELATEDTABLE ( attendance ),
MONTH ( attendance[Date] ) = CurrentMonth
&& YEAR ( attendance[Date] ) = CurrentYear
&& attendance[Absent] = "Present"
),
VAR Clockin = attendance[Clock in]
VAR Clockout = attendance[Clock Out]
VAR NumberOfHours = DATEDIFF ( Clockin, Clockout, HOUR )
RETURN
CurrentRate * NumberOfHours
)
)
Check out the July 2025 Power BI update to learn about new features.
User | Count |
---|---|
23 | |
8 | |
7 | |
6 | |
6 |
User | Count |
---|---|
28 | |
12 | |
10 | |
10 | |
6 |