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

Try your skills in the Power BI Dataviz World Championship! Round one ends June 26. Join now

Reply
muncs
New Member

Divide values from two tables, dynamic required

Hi there,
 
I've got a desk booking app and I'm trying to create the occupancy percentage, I want to do this by counting the number of desks at each site, in the Desks_MasterData table, then divide it by the number of bookings in the Bookings table for each site. Then I want the user to use the slicer filters to filter bookings for that day to get %.
 
I've got it to work but only on Static formuals so the filter doesn't chage.
 
These are the formula's I'm currently working with but they return a 0 result when combined together. When I see the values seperatly they are correct.
 
VAR DesksCount = COUNTROWS(FILTER(Desks_MaterData,Desks_MaterData[D_SiteConcat]=Bookings[SiteConcat]))
VAR BookingsCount = COUNT(Bookings[DateOfBooking])

 

Occ% =
DIVIDE(COUNTROWS(FILTER(Desks_MaterData,Desks_MaterData[D_SiteConcat]=Bookings[SiteConcat])),COUNT(Bookings[DateOfBooking]))
 
Any pointers or assistance on where I'm going wrong would be apprecaited.

 

1 REPLY 1
PC2790
Community Champion
Community Champion

Hello,

 

Can you try:

VAR BookingsCount = CALCULATE(COUNT(Bookings[DateOfBooking]),ALL(Bookings))

 

And then OCC% = DIVIDE([DesksCount],[BookingsCount])

 

As you are trying to get the percentage so the denominator should not be affected by any filters.

 

I hope this works for you

Helpful resources

Announcements
Fabric Data Days is here Carousel

Fabric Data Days 2026

Don't miss out on Data Days, June 15 through August 7. Learn Fabric, Power BI, SQL, AI and more.

May Power BI Update Carousel

Power BI Monthly Update - May 2026

Check out the May 2026 Power BI update to learn about new features.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.