Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!
Hello Power BI Community,
My current client is asking if we could provide them a calculation in the form of a proportion below:
# of clients discharged from Sunday-Sunday 5pm-5pm/ # of total clients served from Sunday-Sunday 5pm-5pm
We have two types of date/time columns: IntakeDate/Time and ExitDate/Time--my assumption is that we would use something based on the ExitDate/Time.
Essentially, I need to calculate:
1) a measure that can count the total amount of clients who were discharged in that date/time frame...and ALSO include the rest of the clients who don't have an exit date at all (that row would be blank within that date/time frame)
2) this measure has to be able to filter a specific week range AND time range
3) and if this could be coded/calculated in a way that can automatically update each week--that would be the gold standard. We are trying to not use interactive/slicers fields on the dashboards. (if possible)
Thank you for anyone who is willing to help!
Solved! Go to Solution.
Hi @viwinski7 ,
You could modify the MaxArrival2 column by the following formula:
count =
CALCULATE (
COUNTROWS ( 'Table' ),
FILTER (
ALL ( 'Table' ),
[ExitDate/Time] = BLANK ()
|| (
WEEKNUM ( [ExitDate/Time] ) = WEEKNUM ( TODAY () )
&& (
(
WEEKDAY ( [ExitDate/Time], 2 ) = 6
&& TIMEVALUE ( [ExitDate/Time] ) < TIMEVALUE ( "17:00:01" )
)
|| (
WEEKDAY ( [ExitDate/Time], 2 ) = 7
&& TIMEVALUE ( [ExitDate/Time] ) >= TIMEVALUE ( "17:00:00" )
)
|| ( WEEKDAY ( [ExitDate/Time], 2 ) IN { 1, 2, 3, 4, 5 } )
))))
The final output is shown below:
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, @viwinski7 ;
Could you please tell me if your problem has been solved?
If it is, could you please mark the helpful replies as a solution to close this topic and help others can learn from it ?
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 @viwinski7 ,
You could modify the MaxArrival2 column by the following formula:
count =
CALCULATE (
COUNTROWS ( 'Table' ),
FILTER (
ALL ( 'Table' ),
[ExitDate/Time] = BLANK ()
|| (
WEEKNUM ( [ExitDate/Time] ) = WEEKNUM ( TODAY () )
&& (
(
WEEKDAY ( [ExitDate/Time], 2 ) = 6
&& TIMEVALUE ( [ExitDate/Time] ) < TIMEVALUE ( "17:00:01" )
)
|| (
WEEKDAY ( [ExitDate/Time], 2 ) = 7
&& TIMEVALUE ( [ExitDate/Time] ) >= TIMEVALUE ( "17:00:00" )
)
|| ( WEEKDAY ( [ExitDate/Time], 2 ) IN { 1, 2, 3, 4, 5 } )
))))
The final output is shown below:
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 , @viwinski7 ,
I am not very clear about your question. Based on my understanding, I have created a simple example to calculate the total of discharged or blank on Sunday; if you want to update automatically, you can change WEEKNUM ( [ExitDate/Time] ) = 12 to WEEKNUM ( [ExitDate/Time] ) = WEEKNUM ( TODAY()); as follows:
count =
COUNTROWS (
FILTER (
ALL ( 'Table' ),
WEEKNUM ( [ExitDate/Time] ) = 12
&& (
[ExitDate/Time] = BLANK ()
|| WEEKDAY ( [ExitDate/Time], 2 ) = 7
&& TIME ( HOUR ( [ExitDate/Time] ), MINUTE ( [ExitDate/Time] ), SECOND ( [ExitDate/Time] ) )
= TIME ( 17, 0, 0 )
)
)
)
The final output is shown below:
If this is still not what you want, please provide me with more details about your table and
your problem or share me with your pbix file after removing sensitive data.
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.
Essentially,
I need this:
but in a way that I don't have to go in each week and update the advanced filter.
User | Count |
---|---|
140 | |
113 | |
104 | |
77 | |
64 |
User | Count |
---|---|
135 | |
122 | |
101 | |
71 | |
61 |