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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
EAF003
Frequent Visitor

Dynamic Allocation from different table

I am trying to create a table or table visual that accomplishes the following, but cannot figure out either the measures/calculations needed to create it. There is an 'opportunity' by Rep table and a monthly 'target' by Division table (see below):

'target'

DivisionDiv_Mo_Target
SMB12
MM6
ENT4

 

'opportunity'

DivisionRepOpportunityClosed Date
ENTAmyDKN1/31/2025
ENTAmySAD1/31/2025
ENTAmyVNF2/28/2025
ENTJakeTXC1/31/2025
ENTJakeVIE1/31/2025
ENTJakeSDE2/28/2025
ENTJakeWOE2/28/2025
ENTTinaFLW1/31/2025
ENTTinaELT2/28/2025
MMSarahJMW1/31/2025
MMSarahWSH2/28/2025
MMSarahJJS2/28/2025
MMTomOLE1/31/2025
MMTomONV1/31/2025
MMTomAAB2/28/2025
MMTomXYZ2/28/2025
SMBBobKSI1/31/2025
SMBBobWER1/31/2025
SMBBobQAS1/31/2025
SMBBobJMI2/28/2025
SMBBobKOW2/28/2025
SMBBobTTO2/28/2025
SMBJoeXHD1/31/2025
SMBJoeEIT1/31/2025
SMBJoeFRL1/31/2025
SMBJoeMKE1/31/2025
SMBJoeCOR2/28/2025
SMBJoePBR2/28/2025
SMBJoeEOP2/28/2025
SMBJoeJVV2/28/2025
SMBMarkKVV1/31/2025
SMBMarkHHW1/31/2025
SMBSallyJKY1/31/2025
SMBSallyQUV1/31/2025
SMBSallyPOS2/28/2025
SMBSallyMMMB2/28/2025

 

I am trying to produce a table or matrix visual that looks like the following but am not certain of the best method to accomplish. Essentially, I want to allocate the monthly target by division by the active reps and then show all reps (active or not) actuals by month. As you can see below the visual is filtered based on which Divisions are selected by the user. 

Any guidance would be greatly appreciated!!!!

 

DivisionRepMo TargetJan-25Feb-25
MMSarah312
MMTom322
MM SUBTOTAL 634
SMBBob433
SMBJoe444
SMBMark 20
SMBSally422
SMB SUBTOTAL 12119
TOTAL 181413

 

1 ACCEPTED SOLUTION
bhanu_gautam
Super User
Super User

@EAF003 

Make sure there is a relationship between the 'Division' columns in both tables.

Calculate the monthly target for each rep by dividing the division's monthly target by the number of active reps in that division for each month.

DAX
Mo Target =
VAR ActiveReps =
CALCULATE(
DISTINCTCOUNT('opportunity'[Rep]),
ALLEXCEPT('opportunity', 'opportunity'[Division], 'opportunity'[Closed Date])
)
RETURN
DIVIDE(
MAX('target'[Div_Mo_Target]),
ActiveReps,
0
)

 

Calculate the number of opportunities closed by each rep for each month.

DAX
Jan-25 =
CALCULATE(
COUNT('opportunity'[Opportunity]),
MONTH('opportunity'[Closed Date]) = 1,
YEAR('opportunity'[Closed Date]) = 2025
)

Feb-25 =
CALCULATE(
COUNT('opportunity'[Opportunity]),
MONTH('opportunity'[Closed Date]) = 2,
YEAR('opportunity'[Closed Date]) = 2025
)

 

Add a Matrix visual to your report.
Drag 'Division' and 'Rep' to the Rows.
Drag the measures 'Mo Target', 'Jan-25', and 'Feb-25' to the Values.
Ensure that the matrix is set to show subtotals and grand totals.




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






View solution in original post

6 REPLIES 6
EAF003
Frequent Visitor

Perfect! Thank you so much

v-pbandela-msft
Community Support
Community Support

Hi @EAF003,

I wanted to check if you had the opportunity to review the information provided. Please feel free to contact us if you have any further questions. If my response has addressed your query, please "Accept  as  Solution" and give a 'Kudos' so other members can easily find it.

Thank you,
Pavan.

v-pbandela-msft
Community Support
Community Support

Hi @EAF003,

Thank you for reaching out in Microsoft Community Forum.

Thank you @bhanu_gautam    for the helpful response.

As suggested by bhanu_gautam,  I hope this information was helpful. Please let me know if you have any further questions or you'd like to discuss this further. If this answers your question, please "Accept as Solution" and give it a 'Kudos' so others can find it easily.

Please continue using Microsoft community forum.

Regards,
Pavan.

EAF003
Frequent Visitor

@bhanu_gautam 
Thank you so much for your quick response!

A couple questions:
1) For the ActiveRep variable how can I adjust to only COUNT (distinct) reps as of the MAX closed date? 
2) On the Monthly Target measure it is using the Target of the Division with the MAX opportunities, can this be adjusted to reflect the Division(s) that are chosen from the Slicer?

@EAF003 Adjust ActiveRep to Count Distinct Reps as of the MAX Closed Date:

MoTarget =
VAR MaxClosedDate = CALCULATE(MAX('opportunity'[Closed Date]))
VAR ActiveReps = CALCULATE(
DISTINCTCOUNT('opportunity'[Rep]),
'opportunity'[Closed Date] = MaxClosedDate
)
RETURN DIVIDE(
MAX('target'[Div_Mo_Target]),
ActiveReps,
0
)

 

To ensure the monthly target measure reflects the selected division(s) from the slicer, you can use the SELECTEDVALUE function to dynamically get the division from the slicer context. Here is the adjusted DAX code:

MoTarget =
VAR SelectedDivision = SELECTEDVALUE('opportunity'[Division])
VAR MaxClosedDate = CALCULATE(MAX('opportunity'[Closed Date]))
VAR ActiveReps = CALCULATE(
DISTINCTCOUNT('opportunity'[Rep]),
'opportunity'[Closed Date] = MaxClosedDate,
'opportunity'[Division] = SelectedDivision
)
RETURN DIVIDE(
CALCULATE(MAX('target'[Div_Mo_Target]), 'target'[Division] = SelectedDivision),
ActiveReps,
0
)




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






bhanu_gautam
Super User
Super User

@EAF003 

Make sure there is a relationship between the 'Division' columns in both tables.

Calculate the monthly target for each rep by dividing the division's monthly target by the number of active reps in that division for each month.

DAX
Mo Target =
VAR ActiveReps =
CALCULATE(
DISTINCTCOUNT('opportunity'[Rep]),
ALLEXCEPT('opportunity', 'opportunity'[Division], 'opportunity'[Closed Date])
)
RETURN
DIVIDE(
MAX('target'[Div_Mo_Target]),
ActiveReps,
0
)

 

Calculate the number of opportunities closed by each rep for each month.

DAX
Jan-25 =
CALCULATE(
COUNT('opportunity'[Opportunity]),
MONTH('opportunity'[Closed Date]) = 1,
YEAR('opportunity'[Closed Date]) = 2025
)

Feb-25 =
CALCULATE(
COUNT('opportunity'[Opportunity]),
MONTH('opportunity'[Closed Date]) = 2,
YEAR('opportunity'[Closed Date]) = 2025
)

 

Add a Matrix visual to your report.
Drag 'Division' and 'Rep' to the Rows.
Drag the measures 'Mo Target', 'Jan-25', and 'Feb-25' to the Values.
Ensure that the matrix is set to show subtotals and grand totals.




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.