Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
Mamtas
Frequent Visitor

dividing by unique values. Do not use sum or count

I have these 2 tables YTD and Budgets. I need to create a measure in YTD, where it sum the Booked session as per centre , divide that by number of days and whatever the result is, Divide that by staffed places from Budgets table. This way i will get the actaul occupancy rate per centre

Example Centre Alfi occupancy % = ((25+25+25+25)/4) / 46 = 54.3%

 

I would also like to show the Budget % in table visual to show as a comparison.  That number should always be static

 

Example Alfi's actual % as above calculated is 54.3%, but their Budget % from Budget table is 87.7%

YTD

CentreBooked sessionDays
ABC40Monday
ABC38Tuesday
ABC36Wednesday
ABC34

Th

ursday

ABC32Friday
DEF15Monday
DEF16Tuesday
DEF17Wednesday
DEF18Thursday
DEF19Friday
alfi25Monday
alfi25Tuesday
alfi25Wednesday
alfi25Thursday
ABC38Friday
ABC36Monday
ABC34Tuesday
ABC32Wednesday
ABC30Thursday

Budgets

Centre names with 'Budget %Staffed Places
alfi87.7%46
DEF90.2%71
ABC87.9%90
1 ACCEPTED SOLUTION

Hi Ryan,  First of all , thanks so much for your response.  Even after everything, i was not able to get the formulas to work for every centre.  

Finally , i found the solution, by just changing the cross filter direction (as below) to 'Both' in relations.

 

Thanks again for your help

Mamtas_0-1703646869052.png

 

View solution in original post

11 REPLIES 11
Mamtas
Frequent Visitor

Thank Ryan, but no.

 

First it needs to divide the sum of budget places to the count of number of days and whatever the result is, divide that by staffed places for that particular centre.  

 

I have tried 2 ways

FIRST WAY

 Measure 2 = 

(sum('YTD'[Booked Sessions]) / count('YTD'[Days_1]))
 
Then created another mesaure
Measure 3= Measure 2/ sum (Budgets[Staffed Places]'

This works on some centres, but giving me wrong results on other.  

 

SECOND WAY

I have tried this

Measure 2 =
(sum('YTD'[Booked Sessions])/count('YTD'[Days_1]))
/
LOOKUPVALUE(Budgets[Staffed Places],Budgets[Centre names with '],'YTD'[Centre])
 
But here lookupvalue function is giving me error   at this place  "'YTD'[Centre]"
Error is    " single value for column 'Centre' in table 'YTD' cannot be determined. This can happen when a measure formula refers to a column that contains many values without specifying an aggregation such as min, max, count, or sum to get a single result.'
I then tried using sum, min , max function , however that does not make any sense here as Centre is a text field. But nothing.
Here is my relationship
Mamtas_0-1702509759643.png

 

 

what's the expected output based on the sample data you provided?





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Calculating the occupancy %

 

Example Centre Alfi occupancy % = ((25+25+25+25)/4) / 46 = 54.3%

 

Alfi was open 4 days with 25 occupied places per day, therefore there per day occupancy was 25

((25+25+25+25))/4 = 25

But there budget staffed places were 46 (from budget table)

Therefore their occupancy is 25/46= 54.3

 

 

that's what I get for alfi as well. I used the same logic as you mentioned

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Which one, 

First way or second ?

@Mamtas

pls try this

Measure = average('YTD'[Booked session])/sum('budget'[Staffed Places])

 

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Thanks mate, it works just like mine. i.e. works for some centres, but others giving wrong calculation.  That's the reason i tried lookup function, but that didnt work either.

 

sometime Excel seems like a much better option.  At least you can see the calculation steps and see why and where is the mistake.

then pls update the sample data or provide the output for other center.

So far, I can't figure out the mistake. We need more info.

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




ryan_mayu
Super User
Super User

@Mamtas 

is this what you want?

Measure = average('YTD'[Booked session])/sum('budget'[Staffed Places])

11.PNG

pls see the attachment below





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Hi Ryan,  First of all , thanks so much for your response.  Even after everything, i was not able to get the formulas to work for every centre.  

Finally , i found the solution, by just changing the cross filter direction (as below) to 'Both' in relations.

 

Thanks again for your help

Mamtas_0-1703646869052.png

 

you are welcome





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors