cancel
Showing results for
Did you mean:
Helper III

## Grouping to get by date for getting percentages

I am trying to get a totall occupancy for a group of locaions.  We have some locations that have two people per room and some that have one person per room.  Both people are in the database but they will have the same unit number.  The other zinger here is that the Max Occupancy changed at one locaton to a lower ammount.  Here is a sample of the data:

 Date Location ID Max occupancy Date Location ID Max Occupancy 9/29/2020 Fargo 101 140 10/1/2020 Moorhead 502 108 9/30/2020 Fargo 102 140 10/1/2020 Moorhead 503 108 10/1/2020 Fargo 300 140 9/29/2020 Moorhead 500 115 9/29/2020 Moorhead 500 115 9/29/2020 Moorhead 502 115 9/29/2020 Moorhead 503 115 10/1/2020 Moorhead 500 108 10/1/2020 Moorhead 500 108

So, I need to count the ID of 500 as 1 as we do not look at people but at units when looking at occupancy.

Issue number 1. Numerator needs to be 1 count per unit per day.

Issue number 2. The denominator changes October 1st.  So I want to use the old Max through the 30th and the new max going forward.

Thanks for any help.

Peter

1 ACCEPTED SOLUTION
Community Support

Hi @petermb72 ,

Please check the following measure.

``Measure = CALCULATE(DISTINCTCOUNT('Table'[ID]),ALLEXCEPT('Table','Table'[Date],'Table'[Location]))/SELECTEDVALUE('Table'[Max occupancy])``

Result would be shown as below.

Best Regards,

jay

Community Support Team _ Jay
If this post helps, then please consider Accept it as the solution
to help the other members find it.
5 REPLIES 5
Helper III

The desired output would be showing what my occupancy based on rooms, not ID numbers is each day.  So for instance:

Occupancy Percentages:

9/29 Fargo 1 divided by 140
9/30 Fargo 1 divided by 140
10/1 Fargo 1 divided by 140
9/29 Mooread 3 divided by 115 (ID 500 has two on the same date, that is a shared room I want to only count as 1)
10/1 Moorhead 3 divided by 108 (ID 500 is doubled up on same date so they are in one unit and the max occupancy has shrunk to 108 vs 115)

So what I want to get for the max occupancy is

9/29 Fargo Occ = .7%
9/29 Moorhead Occ = 2.6%

10/1 Fargo Occ = .7%

10/1 Moorhead = 2.78%

Does this help?

Community Support

Hi @petermb72 ,

Please check the following measure.

``Measure = CALCULATE(DISTINCTCOUNT('Table'[ID]),ALLEXCEPT('Table','Table'[Date],'Table'[Location]))/SELECTEDVALUE('Table'[Max occupancy])``

Result would be shown as below.

Best Regards,

jay

Community Support Team _ Jay
If this post helps, then please consider Accept it as the solution
to help the other members find it.
Super User

Thanks for that.

A measure like this

``Measure = DIVIDE(DISTINCTCOUNT(TableGH[ID]) ,MIN(TableGH[Max occupancy]))``

Alter the Measure Format for decimal places/percentage

Helper III

I know the subject description stinks, but comeone one of you people with huge brains surely know the answer to this.........

Super User

I think the huge brains will know the answer but they might not know the question!

Perhaps you could show the desired output from the data sample (with an explanation of anything not obvious).  I'm sure someone can help you.

Announcements

#### Microsoft Build is May 24-26. Have you registered yet?

Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.

#### Charticulator Design Challenge

Put your data visualization and design skills to the test! This exciting challenge is happening now through May 31st!

#### What difference can a User Group make for you?

At the monthly call, connect with other leaders and find out how community makes your experience even better.