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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

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
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.