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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
GuntherCoppens
Regular Visitor

DAX Measure Help

I have the following snowflake model:

 

CDS Timesheet Line
TimesheetTimesheet LineDateProjectChargeableTimesheet Key
TS11000004.01.19CDK005YesTS110000
TS12000005.01.19HIT012NoTS120000
TS13000005.01.19CDK005YesTS130000
TS14000006.01.19HIT001NoTS140000

 

Table: CDS Timesheet Details

Timesheet;Timesheet Line;Date;Hrs;Timesheet Key

TS11000004.01.198TS110000
TS12000005.01.194TS120000
TS13000005.01.194TS130000
TS14000006.01.198TS140000

 

 

CDS Date = Calendarauto()

Date;Calendar Year;Calendar Month;CalendarYearMonth

04.01.192019120191
05.01.192019120191
06.01.192019120191

 

Capacity

YearMonth;Days;Hours

2019122176
2019220160
2019321168
2019418144
2019520160
2019622176
2019718144
2019820160
2019922176
20191021168
20191121168

 

Trying to show table relations via the colors 🙂

 

I would like a measure to calculate the % billable of a given resource in a given month. I appreciate I did not specify the resource in the above, that sits in another table linked to CDS Timesheet Details, but I am assuming for now that this does not matter:

'= sum of timesheet details billable hours of the resource in the month / (capacity of the month - sum of timesheet details hours of the resource in that month registered on project HIT012)

 

I can nicely create a measure like this:

Table: CDS Timesheet Details

TotalHol = SUMX(filter('CDS Timesheet Details';RELATED('CDS Timesheet Line'[Job_No])="HIT012");'CDS Timesheet Details'[Quantity])

 

But I keep struggling with the above mentioned measure: % billable of a given resource in a given month? Any thoughts

3 REPLIES 3
Anonymous
Not applicable

hi @GuntherCoppens ,

 

You can try to create the following measures:

 

 

TotalHours = CALCULATE(
     SUM( 'CDS Timesheet Details'[Hrs] )
)

 

 

TotalHoursBillable = CALCULATE(
     SUM( 'CDS Timesheet Details'[Hrs] );
     FILTER(
            'CDS Timesheet Line';
            'CDS Timesheet Line'[Chargeable] = "yes"
     )
)

 

 

Billable% = DIVIDE(
    [TotalHoursBillable];
    [TotalHours]
)

 

 

Then create a matrix visualisation with 'CDS Date'[month] as rows and 'CDS Timesheet Line'[Project] as columns. Drop the measures in the values field of the visualisation. This should produce the total hours, total billable hours and billable % per project per month.

Thanks @Anonymous . However it does not comply with the required definition:

sum of timesheet details billable hours of the resource in the month / (capacity of the month - sum of timesheet details hours of the resource in that month registered on project HIT012)

 

Further thoughts?

Anonymous
Not applicable

My mistake @GuntherCoppens 🙂 So you want to calculate every single project's billable hours as a percent of the total capacity per month? And the total capacity is not allocated to each project? In that case I would create the following measures:

 

TotalCapacity = CALCULATE(
    SUM('Capacity'[Hours])
)

 

 

 

BillableOfCap = 
DIVIDE(
    [TotalHoursBillable];
    [TotalCapacity] - [TotalHours]
)

 

 

Drop these two measures in the matrix visualisation with time on one axis and projects on another, and the calculation should work.

 

[TotalHours] will calculate the number of hours in all timesheets across each project in the matrix. 

[TotalHoursBillable] will calculate the same as [TotalHours], but filtered to only the billable hours

[TotalCapacity] will calculate the total capacity per month in the matrix. Since the Capacity table is not filtered by the timesheets tables, it will show the same values across all projects in the matrix.

[BillableOfCap] is simply a division of the above measures, where the denominator is [TotalCapacity] subtracted by [TotalHours] as per your specification.

 

Hope this helps!

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

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