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
arythedj
Helper I
Helper I

How Many Drivers Available

Hi, 

 

I have jobs table listed like below:

 
 

job table.png

 

I have another table called driver log that looks like the below:

Driver Log.png

 

So in pivot above, how do I put a new measure called "Available Drivers".

So pivot should look like this:

Pivot Result.png

 

Appreciate the help.

 

Regards,

Bryan

1 ACCEPTED SOLUTION
Anonymous
Not applicable

@arythedj Use this measure to include zone as well in available driver calculation. If it does not work please share sample data to reproduce the scenario

Measure = 
VAR _jobDate = MAX(Job[Job date time])
VAR _zone = SELECTEDVALUE(Job[zone])
RETURN CALCULATE(COUNT(DriverLog[Driver id]),FILTER(DriverLog,DriverLog[Login]<=_jobDate && DriverLog[Logout]>=_jobDate && DriverLog[zone]=_zone))

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

@arythedj 

please create a measure as per below

Measure = 
VAR _jobDate = MAX(Job[Job date time])
RETURN CALCULATE(COUNT(DriverLog[Driver id]),FILTER(DriverLog,DriverLog[Login]<=_jobDate && DriverLog[Logout]>=_jobDate))

Driver.png 

@Anonymous thanks so much, it seems to be working. Just 1 little issue I have.

 

Currently, in jobs table, there is a field called 'zone'. This field is used as a slicer in the report.

 

In driver log table, there is also a field called 'zone'

 

How to make the measure to also consider selected slicer in the report?

Anonymous
Not applicable

@arythedj Use this measure to include zone as well in available driver calculation. If it does not work please share sample data to reproduce the scenario

Measure = 
VAR _jobDate = MAX(Job[Job date time])
VAR _zone = SELECTEDVALUE(Job[zone])
RETURN CALCULATE(COUNT(DriverLog[Driver id]),FILTER(DriverLog,DriverLog[Login]<=_jobDate && DriverLog[Logout]>=_jobDate && DriverLog[zone]=_zone))

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.

Top Solution Authors