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

Need help in creating measure

Hi All,

I have the following 2 tables. Table 1:

ClassSemesterStudentProgram
ABCD1001003030IT
ABCD1001002020BBA
EFGH1001002020BBA

 

Table 2: ( all calculated columns are calculated in DAX and not query)

ClassSemesterTeacherSalary in Term (calculated column through related())Number of sections
(Calculated column through calculate() and filter())

Enrolled Students

(Calculated column through calculate() and Filter from Table1)

Cost per Student

(calculated column = salary / number of sections / number of students)

EFGH100Hamda200002110000
ABCD100Hamda20000225000
ABCD100Ali10000125000

 

What I am trying to get to is:

TeacherCost to Program
Ali
    IT Program
    BBA Program

5000
5000
Hamda
    IT Program
    BBA Program

5000
15000

 

Is creating a measure for this task possible? What is the formula and Where Do I create this measure? BTW, I have more tables in my models but the above should simplifies my requirement. Below are details:Capture.PNG

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi you can create a matrix to achieve this.

rows = teacher & program

values = cost

teachercost.PNG

as in your example you can disable subtotals like this:

nosubs.PNG

View solution in original post

4 REPLIES 4
v-yiruan-msft
Community Support
Community Support

Hi @Hassanmoussa,

Please check if the solution provided by @Anonymous (using the matrix visual ) can help you get the result you want . If no , please provide which tables the fields used in your expected result are from ? And if there is any measure or calculated column applied , please also provide the relevant formula . If these fields are from different tables, please provide the join field between 2 tables. Thank you .

 

Best Regards

Rena

Community Support Team _ Rena
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hello,

 

Many thanks @v-yiruan-msft and @Anonymous. Unforunetly it is not what I am looking for.

 

I am trying to create a measure not a visual that will count (or sum) the faculty cost for each student enrolled in a class. Let me know if what I say makes sense.

 

As an example, see below cost per student? I want to aggregate that. The real sum will be 100 Million+. But the below table is showing 13 million only because these amounts are defined in the course instructors table. 

I guess a formula would = sum(count(student id) * cost per student). But this is not working.

Capture2.PNG

Hi @Hassanmoussa

From the information you provided earlier, cost per student is a calculated column whose calculation formula is (salary / number of sections / number of students). Could you please provide which columns from which tables are involved? I'm not sure if there will be a context change when put the previous calculated column into new measure...

In addition, how do you calculate faculty cost in real life?Could you please provide your PBIX file if it is convenient?

 

Best Regards

Rena

Community Support Team _ Rena
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Hi you can create a matrix to achieve this.

rows = teacher & program

values = cost

teachercost.PNG

as in your example you can disable subtotals like this:

nosubs.PNG

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.