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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
sambgv
Helper I
Helper I

DAX Formula, Filtering Complications

Hello, community! 

So I have a formula that should compute the total hours for work efforts in an organisation. These efforts are booked in certain accounts, and in these accounts there are certain projects where people book. If a person is assigned to multiple teams, his/her work efforts should be distributed among teams according to % allocation. So on one side we have a total of efforts (in hours) that gets distributed to assigned teams and on the other side, we have just a total of efforts made on a specific day. (imagine a matrix: column day; values: TotalDistrubuted and Total efforts.) I came up with the following formula : 

VAR _SUMINTHrs =
CALCULATE (
    SUM ( 'FACT_Table1' [TimeHours] ),
    SUMMARIZE (
        'FACT_Table1',
        'FACT_Table1' [ID_acct_project_user_mth] ) )
VAR _CountRows =
COUNTROWS (
        DISTINCT ( 'FACT_Table1'[ID_user_team_mth] ) )
VAR _Result =
DIVIDE (
    _SUMINTHrs,
    _CountRows )
RETURN _Result


The initial problem was if a person is assgined to many teams, his/her total effort per day is duplicated since there are several rows to calculate the team efforts allocation. For eg. a person is assigned to 5 teams, and the total of booked efforts is 7 hours (for one day). This time will be allocated to 5 teams accordingly and person's total booking for this day will be 35 hours. The above formula seemed to solve the problem when I filtred users one by one in a matrix. The problem arises when I filter one team and pick a month. What formula does here is basically taking the total amount of all people in a team and divides it by a unique number of team members. For example: 20 members booked 1 hour per person (lets say today), totaling to 20 hours (per team) and then the formula divides this number by these 20 unique members, which gives me 1 hour for the whole team. Of course, when I just filter by month, the problem is the same. 

Does anybody have any suggestions as to how solve this problem? 🙂 Sorry if the discription is vague or lacking info. Due to data compliance, I can't go into much detail.. 

3 REPLIES 3
Anonymous
Not applicable

Hi @sambgv ,

Can you please share a pbix or some dummy data that keep the raw data structure with expected results? It should help us clarify your scenario and test to coding formula.

How to Get Your Question Answered Quickly  

Regards,

Xiaoxin Sheng

hi @Anonymous @some_bih 

 

I have created sample data. You can find it here 

 https://drive.google.com/drive/folders/1YUwcu8rDAIs_UKgWFpBLzQwWL139okT7?usp=sharing

 

 

 

My overall objective is the following: 

  • I need to see the correct sum of TotalTime booked per team per account in the date columns. Eventually the total sum of booked hours per team at the end of each months (summing up all accounts)
  • On the user level: the TotalTime in the date columns. 
  • Generally, what i need is the correct sums 😄 when i make use of slicers in the report 

Report View Sample.pngDAx sample.png

some_bih
Super User
Super User

Hi @sambgv in your measure definition, part SUMMARIZE (after CALCULATE) is written what you want to calculate

 'FACT_Table1' [ID_acct_project_user_mth]  

Depending what is your details of fact table (team ID, member id, hours / minutes...) and what is your request for aggregation, define your measure.

This stand for your monthly level of data. Sometimes, simple caclulated columns could "enrich" your initial inputs for your outputs.

Check your inputs and level of output. I hope this help

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!






Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.