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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
alexwardeee
Regular Visitor

Last 30 Days and Last 7 Days measure.

 

Hi all,

 

I just wanted to ask what is the best way to get a percentage of booked desks to available desks. I currently have a measure like this. 

 

DividePercentageCountMax = IF (
DIVIDE(DataTable[ColumnExample], DataTable2[ColumnExample2]) = BLANK(),
0,
DIVIDE(DataTable[ColumnExample], DataTable2[ColumnExample2])
 
This works but only when i select one day from the the slicer.
 

alexwardeee_1-1643812389537.png

 

alexwardeee_2-1643814076136.png

 

When i try to do this for the full month of January for example my measure now looks like this - 

 

alexwardeee_3-1643814323683.png

I want to try and get the last 7 days and last 30 days average of used desks. Not sure how this will work in regards to weekdays too.

 

Any help would be greatly appreciated!

4 REPLIES 4
amitchandak
Super User
Super User

@alexwardeee , names are not matching with name visual to check calculation.

 

ColumnExample2, ColumnExample should be measures

else you should have measure like

 

DIVIDE(sum(DataTable[ColumnExample]), sum(DataTable2[ColumnExample2]),0)
 
If this does not help
Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.

Hi,

 

Sorry was just trying to be super careful but the names are not important to be honest.

 

Here is the original measure - 


DividePercentageCountMax = IF (
DIVIDE(DeskBookingReport08122021[CountServiceArea], AllocationData[MaxValue]) = BLANK(),
0,
DIVIDE(DeskBookingReport08122021[CountServiceArea], AllocationData[MaxValue])
)

Says there is an issue -

 

alexwardeee_0-1643817684390.png

 

CountServiceArea is a measure if that might be the issue?

Hi @alexwardeee ,

According to your description, I create a sample.

vkalyjmsft_0-1644374685353.png

Based on this sample, here's the solution.

Create three measures.

CountServiceArea = SUM('DeskBookingReport08122021'[Booked Desks])
MaxValue = SUM('DeskBookingReport08122021'[Avaliable Desks])
Percentage of used desks = DIVIDE([CountServiceArea],[MaxValue],0)

 It will get the correct result, regardless of whether the slicer chooses a value.

vkalyjmsft_1-1644374968824.png

If your sample is different from mine, could you please explain it more? what's the formula of CountServiceArea and MaxValue.

 

I attach my sample below for reference.

 

Best Regards,
Community Support Team _ kalyj

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

 

Hi @v-yanjiang-msft,

 

Thanks for the responce.

 

I tried to use your solution but encoutered a couple of issues which i will note below.

 

The first issue i had was the 

CountServiceArea = SUM('DeskBookingReport08122021'[Booked Desks])

The booked desk count is actually a string so it errors when it trys to SUM it. 

 

Secondly the 

MaxValue = SUM('DeskBookingReport08122021'[Avaliable Desks])

Is from it's own table which i have entered in manually as it shows the allocated desks per service area. 

See screenshot - 

alexwardeee_0-1644509809848.png

When i select multiple dates from the slicer it doesn't seem to sum all these totals.

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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