Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
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
)
)
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
14 | |
11 | |
10 | |
10 | |
9 |
User | Count |
---|---|
18 | |
13 | |
12 | |
11 | |
8 |