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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
Amin_Adham
Regular Visitor

Measures created in a table, does not work and filter other tables.

Hello everyone.
I have been faced a problem as below details:

I have a timesheet table for our projects containing Month, Project Code and the total hours spent on each project monthly.

in another table, I have a financial transaction table which the costs, revenue, overhead etc are measured.
these two tables are not related in model.

the third table is connecting to both named project master.
it is a list of project with names and details (type, short name, code etc) which is connected to timesheet table through project code column and also to transaction table.

I want to create an allocated measure that allocates the overhead expenses to each project, based on the percent of their hours.

I created a measure for calculating the percent of total for each project as below:

Total Hours = CALCULATE(
    '01- Project Hours'[Hours],
    ALL(
        '01- Project Hours'[Project Code],
        '01- Project Hours'[Year],
        '01- Project Hours'[Month]
    )
)
and then:
Percent of total = '01- Project Hours'[Hours]/[Total Hours]

and it worked well. in hours table, i can use it for projects and months and it filters correctly.

but when I try to use this measure in my transaction table, it doesnt filter the projects

I now the problem is from my data Model, but please tell me how to fix it and what is the best data model for these kind of related tables.

2 REPLIES 2
amitchandak
Super User
Super User

@Amin_Adham , the above seem like a column not measure , measure should be like

 

Total Hours = CALCULATE(
Sum('01- Project Hours'[Hours]) ,
ALL(
'01- Project Hours'[Project Code],
'01- Project Hours'[Year],
'01- Project Hours'[Month]
)
)
and then:
Percent of total = divide(sum('01- Project Hours'[Hours]),[Total Hours])

 

Try the above and check

Hi Dear Amit and thanks for the respond and considration.

the measures are fine. I didnt use the SUM before '01- Project Hours'[Hours]  because it was a measure itself.

I forgot to mention I had another measure called: Hours wich is:

Hours = sum('01- Project Hours'[Hour])

So all my typings and formulas are just the same as you advised.
but when I use it on my other table, It doesnt filter them.

in it's own table, it's just working fine.
Amin_Adham_0-1684775216521.png

the next Measure I created is:

Allocated Overhead = CALCULATE[Overhead Expenses],  ALL( '00- JV List'[Month]))*[Percent of total]

Overhead expenses is also a measure:
Overhead Expenses =
CALCULATE(
    [Amount Dr (CR)],
    '00- JV List'[Title1]="Operational Expenses",
    '00- JV List'[Title4]= "Tehran Office"||
    '00- JV List'[Title4]= "Tenders"||
    ISBLANK('00- JV List'[Title4]||ALL('00- Persian Month'[Persian Month])))

here is the relationship between tables:

Amin_Adham_1-1684775434948.png

 

 

Kindly Please advise.

 

Helpful resources

Announcements
July 2024 Power BI Update

Power BI Monthly Update - July 2024

Check out the July 2024 Power BI update to learn about new features.

PBI_Carousel_NL_June

Fabric Community Update - June 2024

Get the latest Fabric updates from Build 2024, key Skills Challenge voucher deadlines, top blogs, forum posts, and product ideas.

Top Solution Authors