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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Kraftfood
Helper I
Helper I

Filter the results based on a date and grade field - only latest grade

Hello community,

I have an issue with a dax formula. 

Please see my data:

Kraftfood_0-1695111310628.png

 

NameGradeWeek end dateDays AvailableDays WorkedWeekly utilization
Resource 1Grade 108/01/20235480%
Resource 1Grade 115/01/20235240%
Resource 1Grade 122/01/20235480%
Resource 1Grade 129/01/202355100%
Resource 1Grade 205/02/20235240%
Resource 1Grade 212/02/202355100%
Resource 1Grade 219/02/20235480%
Resource 2Grade 308/01/202355100%
Resource 2Grade 315/01/202355100%
Resource 2Grade 322/01/202355100%
Resource 2Grade 329/01/202355100%
Resource 2Grade 305/02/202355100%
Resource 2Grade 312/02/20235480%
Resource 2Grade 319/02/2023500%
Resource 3Grade 108/01/20235240%
Resource 3Grade 115/01/202355100%
Resource 3Grade 222/01/20235480%
Resource 3Grade 229/01/202355100%
Resource 3Grade 305/02/202355100%
Resource 3Grade 312/02/202355100%
Resource 3Grade 319/02/202355100%

 

I use a calendar table linked to this "Week end date" field.

I calculate the utilization with a measure "divide(sum(days worked) , sum(days available))"

I use date filter the obtain the utilization split per period.

I want now to obtain the utilization based on the latest grade of the resource.

For example, for the resource 1, it would be only for the grade 2, so for the entire period: 11 / 15 = 73%. For the resource 3 it would be only for the grade 3: 15 / 15 = 100%...

I tried many measures, tried to add columns with the latest grade, ... but the results of the utilization are never correct. 

Anyone able to crack it please? 

7 REPLIES 7
v-xinruzhu-msft
Community Support
Community Support

Hi 

Hi?

Hi @Kraftfood 

You can create a measure

Measure 2 = var a=MAXX(FILTER(ALLSELECTED('Table'),[Name] IN VALUES('Table'[Name])),[Grade])
var b=SUMX(FILTER(ALL('Table'),[Name] in VALUES('Table'[Name])&&[Grade]=a),[Days Available])
var c=SUMX(FILTER(ALL('Table'),[Name] in VALUES('Table'[Name])&&[Grade]=a),[Days Worked])
return DIVIDE(c,b)

Output

vxinruzhumsft_0-1695281006717.png

 

Best Regards!

Yolo Zhu

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

Hi v-xinruzhu-msft

Thanks a lot for your help, the results are almost what I wanted!

There is a slight difference between what the results should be and the outcome of the measure.

Resource A got promoted to a new grade the 01.07.2023. Total days worked = 31, total days available = 34. Utilization should be 91.18%, but the measure is giving 94.12%. There are no filters on a period. See utilization of resource A for 2023 and the results on the utilization measure below.

Kraftfood_1-1695283750666.png

Kraftfood_2-1695283847686.png

 

The utilization from the measure is sligthly off compared to the correct utilization for other resources that got promoted during the year and for all other resources.

I am not sure what would you need to investigate more, please let me know so I can share with you 🙂 

Best Regarde.

See below the detail of its available days and worked days.

Kraftfood_0-1695283044288.png

ResourceDateGradeDays AvailableDays Worked
Resource A08/07/2023New Grade00
Resource A15/07/2023New Grade22
Resource A22/07/2023New Grade33
Resource A29/07/2023New Grade00
Resource A31/07/2023New Grade00
Resource A05/08/2023New Grade00
Resource A12/08/2023New Grade0 
Resource A19/08/2023New Grade0 
Resource A26/08/2023New Grade0 
Resource A31/08/2023New Grade00
Resource A02/09/2023New Grade00
Resource A09/09/2023New Grade00
Resource A16/09/2023New Grade00
Resource A23/09/2023New Grade00
Resource A30/09/2023New Grade00
Resource A07/10/2023New Grade00
Resource A14/10/2023New Grade00
Resource A21/10/2023New Grade00
Resource A28/10/2023New Grade00
Resource A31/10/2023New Grade0 
Resource A04/11/2023New Grade00
Resource A11/11/2023New Grade00
Resource A18/11/2023New Grade0 
Resource A25/11/2023New Grade0 
Resource A30/11/2023New Grade11
Resource A02/12/2023New Grade44
Resource A09/12/2023New Grade44
Resource A16/12/2023New Grade55
Resource A23/12/2023New Grade55
Resource A30/12/2023New Grade53
Resource A31/12/2023New Grade54
Total Resource A New Grade 3431

Hi @Kraftfood 

The new  data you provided is different from the original data, i am confused that what does the new grade mean? you said you want to find the latest grade based on the date, how to filter it based on the "New grade"?

 

Best Regards!

Yolo Zhu

Hi @v-xinruzhu-msft , sorry the new data provided was manually written. I have re-written the new data keeping the same format as the first post.

In the first post I created everything manually, in the screenshot below we see the actual days avaivable and days worked of a resource. Before the week end date 08.07.2023 the grade was "Grade 1"

Kraftfood_0-1695285025066.png

 

NameWeek end dateGradeDays AvailableDays WorkedWeekly utilization
Resource 108/07/2023Grade 2000%
Resource 115/07/2023Grade 222100%
Resource 122/07/2023Grade 233100%
Resource 129/07/2023Grade 2000%
Resource 131/07/2023Grade 2000%
Resource 105/08/2023Grade 2000%
Resource 112/08/2023Grade 20 0%
Resource 119/08/2023Grade 20 0%
Resource 126/08/2023Grade 20 0%
Resource 131/08/2023Grade 2000%
Resource 102/09/2023Grade 2000%
Resource 109/09/2023Grade 2000%
Resource 116/09/2023Grade 2000%
Resource 123/09/2023Grade 2000%
Resource 130/09/2023Grade 2000%
Resource 107/10/2023Grade 2000%
Resource 114/10/2023Grade 2000%
Resource 121/10/2023Grade 2000%
Resource 128/10/2023Grade 2000%
Resource 131/10/2023Grade 20 0%
Resource 104/11/2023Grade 2000%
Resource 111/11/2023Grade 2000%
Resource 118/11/2023Grade 20 0%
Resource 125/11/2023Grade 20 0%
Resource 130/11/2023Grade 211100%
Resource 102/12/2023Grade 244100%
Resource 109/12/2023Grade 244100%
Resource 116/12/2023Grade 255100%
Resource 123/12/2023Grade 255100%
Resource 130/12/2023Grade 25360%
Resource 131/12/2023Grade 25480%
Total Resource A New Grade 343191%

See another example

Kraftfood_3-1695284626290.png

 

 

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.