Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.
Hi Dears,
Can someone help me please to do a calculation for total staying in accommodation based on movement type (check-in/check-out) and consider the other filter like per user number and per requester of movement type
- The logic will be:
Total_Stay = (date and time for check out) - (date and time for check-in) per User, per requester, and per accommodation
below is an example of the data:
date and time | Date | User | Accommodation | Movement type | Requester |
9/23/2021 16:12 | 9/23/2021 | User 1 | ACC1 | Check-In | Requester 1 |
9/25/2021 16:53 | 9/25/2021 | User 1 | ACC1 | Check-Out | Requester 1 |
9/23/2021 16:12 | 9/23/2021 | User 2 | ACC1 | Check-In | Requester 3 |
9/25/2021 16:53 | 9/25/2021 | User 2 | ACC1 | Check-Out | Requester 3 |
Thanks and looking forward to your support.
Solved! Go to Solution.
@yazoubi , parenthesis are wrong place , Please check my doubts
Datediff(
calculate(min(Table[Date Time]), allexcept(Table,Table[Requester], Table[Accommodation], Table[User]), filter(Table, Table[Movement type] ="Check-In"))
, calculate(Max(Table[DAte Time]), allexcept(Table,Table[Requester], Table[Accommodation], Table[User]), filter(Table, Table[Movement type] =" Check-Out"))
, day)
Or Paste the formula in text format
@yazoubi , Try a new measure like
Datediff(calculate(min(Table[Date Time]), allexcept(Table,Table[Requester], Table[Accommodation], Table[User]), filter(Table, Table[Movement type] ="Check-In")),4calculate(Max(Table[DAte Time]), allexcept(Table,Table[Requester], Table[Accommodation], Table[User]), filter(Table, Table[Movement type] =" Check-Out")), day)
@yazoubi , parenthesis are wrong place , Please check my doubts
Datediff(
calculate(min(Table[Date Time]), allexcept(Table,Table[Requester], Table[Accommodation], Table[User]), filter(Table, Table[Movement type] ="Check-In"))
, calculate(Max(Table[DAte Time]), allexcept(Table,Table[Requester], Table[Accommodation], Table[User]), filter(Table, Table[Movement type] =" Check-Out"))
, day)
Or Paste the formula in text format
Hi @amitchandak ,
The formula in text format as below
User | Count |
---|---|
16 | |
14 | |
13 | |
12 | |
11 |
User | Count |
---|---|
19 | |
16 | |
15 | |
11 | |
9 |