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
GregVia
Frequent Visitor

Custom measure

Hello All,

 

I have the 2 following table:

 

ProjectRolesFTE budget  ResourceRolesProjectHours
AAAJC0  111JCAAA2
AAACO5  222COAAA1
AAASC5  333JCBBB5
BBBJC4  444SCCCC2
BBBCO0  555COBBB3
BBBSC3  666PMCCC7
BBBPM5  777COCCC4
CCCJC3      
CCCCO3      
CCCSC2      
CCCPM2      

 

Relationship is:

Project to project (1:*)

 

I need a mesaure to calculate the red column:

 

ProjectRolesFTE_BudgetHours
AAAJC02
AAACO51
AAASC50
BBBJC45
BBBCO03
BBBSC30
BBBPM50
CCCJC30
CCCCO34
CCCSC22
CCCPM27

 

Could you please help me with this measure?

 

Many thanks

1 ACCEPTED SOLUTION
PaulDBrown
Community Champion
Community Champion

Here is one way.

1) Create dimension tables (Modeling -> New Table) for the fields Project and Roles using the follwoing pattern:

DProject =
DISTINCT (
    UNION (
        VALUES ( 'FTE Budget Table'[Project] ),
        VALUES ( 'Resource Table'[Project] )
    )
)

2) Set up single direction 1:* relationships between these dimension tables and their corresponding fields in the fact Tables. The model looks like this:

model.jpg

 3) Create the following measures to use in the visual:

Sum FTE Budget = 
SUM('FTE Budget Table'[FTE budget])
Sum Project Hours =
IF (
    ISBLANK ( [Sum FTE Budget] ),
    BLANK (),
    SUM ( 'Resource Table'[Hours] ) + 0
)

4)  create the visual using the fields from the Dimension tables and the measures to get:

result.jpg

I've attached the sample PBIX file

 





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






View solution in original post

1 REPLY 1
PaulDBrown
Community Champion
Community Champion

Here is one way.

1) Create dimension tables (Modeling -> New Table) for the fields Project and Roles using the follwoing pattern:

DProject =
DISTINCT (
    UNION (
        VALUES ( 'FTE Budget Table'[Project] ),
        VALUES ( 'Resource Table'[Project] )
    )
)

2) Set up single direction 1:* relationships between these dimension tables and their corresponding fields in the fact Tables. The model looks like this:

model.jpg

 3) Create the following measures to use in the visual:

Sum FTE Budget = 
SUM('FTE Budget Table'[FTE budget])
Sum Project Hours =
IF (
    ISBLANK ( [Sum FTE Budget] ),
    BLANK (),
    SUM ( 'Resource Table'[Hours] ) + 0
)

4)  create the visual using the fields from the Dimension tables and the measures to get:

result.jpg

I've attached the sample PBIX file

 





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






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.