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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
sambgv
Frequent Visitor

Adding sums from two measures

Classification TeamRole DateValueID_
XAMechanic07-Feb1A_Mechanic_Feb
XBFireman07-Feb1B_Fireman_Feb
XCDoctor07-Feb1C_Doctor_Feb
XPoolBaker07-Feb2

Pool_Baker_Feb

XPoolFireman07-Feb3Pool_Fireman_Feb

The table above is the Supply Table. It shows what roles are assigned to project teams (Letter Teams). The Pool team includes roles that are not assigned to project teams, and are just in the resource pool

 

 

TeamRole DateValueID_team_role_mth
AMechanic07-Feb1A_Mechanic_Feb
BFireman07-Feb1B_Fireman_Feb
CDoctor07-Feb1C_Doctor_Feb

The Table Above is the Demand Table. It shows what roles are needed in project Teams (Letter Teams). It does not contain the Pool team. 

 

The table below is the BridgeTable. I created one to many relationship to both Supply and Demand table by the column Team_role_mth. 

What I need is 1). in a matrix show the difference in values between Supply and Demand (excluding the pool team) by the date columns.

2). in a matrix display the values of the pool team

3). in a bar chart the total of the 1 and 2 by month. For eg. (January Pool Value: 20) + (January Supply-Demand Value:5) = January Bar Chart 25.  And legend should include the classification, which is only present in the supply table. Filtering in the report should be available by Date, Role and Classification. The tables with uniques values for Role, Classification and Dates are presenet in the model. I would appreciate any suggestions. Thanks 

 

TeamRoleDateTeam_mthTeam_role_mth
AMechanic07-FebA_FebA_Mechanic_Feb
BFireman07-FebB_FebB_Fireman_Feb
CDoctor07-FebC_FebC_Doctor_Feb
PoolBaker07-FebPool_FebPool_Baker_Feb
1 ACCEPTED SOLUTION
v-yangliu-msft
Community Support
Community Support

Hi  @sambgv ,

 

Here are the steps you can follow:

1. Create measure.

Question1 =
var _SupplyTable=
SUMX(FILTER(ALL('Supply Table'),YEAR('Supply Table'[Date])=YEAR(MAX('Supply Table'[Date]))&&MONTH('Supply Table'[Date])=MONTH(MAX('Supply Table'[Date]))&&'Supply Table'[Team]<>"Pool"),[Value])
var _DemandTable=
SUMX(FILTER(ALL('Demand Table'),YEAR('Demand Table'[Date])=YEAR(MAX('Supply Table'[Date]))&&MONTH('Demand Table'[Date])=MONTH(MAX('Supply Table'[Date]))),[Value])
return
_SupplyTable - _DemandTable
Question2 =
SUMX(FILTER(ALL('Supply Table'),YEAR('Supply Table'[Date])=YEAR(MAX('Supply Table'[Date]))&&MONTH('Supply Table'[Date])=MONTH(MAX('Supply Table'[Date]))&&'Supply Table'[Team]="Pool"),[Value])
Question3 =
var _Pool=
SUMX(
    FILTER('Supply Table',[Team]="Pool"),[Value])
var _Supply=
SUMX(
    'Supply Table',[Value])
var _Demand=
SUMX(  
    FILTER('Demand Table',
    YEAR('Demand Table'[Date])=YEAR(MAX('Supply Table'[Date]))&&MONTH('Demand Table'[Date])=MONTH(MAX('Supply Table'[Date]))),[Value])
return
_Pool + (_Supply - _Demand)

2. Result:

vyangliumsft_0-1707367454260.png

 

 

Best Regards,

Liu Yang

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

View solution in original post

2 REPLIES 2
v-yangliu-msft
Community Support
Community Support

Hi  @sambgv ,

 

Here are the steps you can follow:

1. Create measure.

Question1 =
var _SupplyTable=
SUMX(FILTER(ALL('Supply Table'),YEAR('Supply Table'[Date])=YEAR(MAX('Supply Table'[Date]))&&MONTH('Supply Table'[Date])=MONTH(MAX('Supply Table'[Date]))&&'Supply Table'[Team]<>"Pool"),[Value])
var _DemandTable=
SUMX(FILTER(ALL('Demand Table'),YEAR('Demand Table'[Date])=YEAR(MAX('Supply Table'[Date]))&&MONTH('Demand Table'[Date])=MONTH(MAX('Supply Table'[Date]))),[Value])
return
_SupplyTable - _DemandTable
Question2 =
SUMX(FILTER(ALL('Supply Table'),YEAR('Supply Table'[Date])=YEAR(MAX('Supply Table'[Date]))&&MONTH('Supply Table'[Date])=MONTH(MAX('Supply Table'[Date]))&&'Supply Table'[Team]="Pool"),[Value])
Question3 =
var _Pool=
SUMX(
    FILTER('Supply Table',[Team]="Pool"),[Value])
var _Supply=
SUMX(
    'Supply Table',[Value])
var _Demand=
SUMX(  
    FILTER('Demand Table',
    YEAR('Demand Table'[Date])=YEAR(MAX('Supply Table'[Date]))&&MONTH('Demand Table'[Date])=MONTH(MAX('Supply Table'[Date]))),[Value])
return
_Pool + (_Supply - _Demand)

2. Result:

vyangliumsft_0-1707367454260.png

 

 

Best Regards,

Liu Yang

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

sambgv
Frequent Visitor

the first requirnment is solved ( i think) by the following dax formula :

SUM(  'Supply' [Value] ) - SUM ('Supply' [Value])

2). I just :
CALCULATE (
Supply[Value],
TeamName = Pool
)

3). i tried adding these measure. and it works, but i can't add classification in the legend of the bar chart, since Classification is only in the supply table. i tried to add a column classification in the demand table, but it created dups in the bridge table, which cannot be since the bridge table is on the one side of the relationship

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.