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
jsbourni
Helper II
Helper II

Prevent summing constant value from another table

Hi,

I have three tables:

  1. Courses (Year, semester, course, students)
  2. Cost (Year, cost)
  3. Year (Year)

There are multiple courses per semester and per year. There is only one flat cost per year. The table Year contains distinct values. Tables are connected through Year.

My goal is to show the flat cost for each course if there is at least one student in a course:

Course, students, cost

 

I tried several things, but the reasoning behind is this :

IF([students] <> BLANK(), SUM('Cout CC'[cost]), BLANK())
 
Obviously, it does not work. Costs keep getting summed and I'm looking to show only the yearly value.
As I mentioned, I tried with CALCULATE (which I think is necessary here for filtering), but I only
get summed values.
 
Thanks
 
 
2 REPLIES 2
amitchandak
Super User
Super User

@jsbourni , Create a new column in Courses 

 

Cost = sumx(filter(Cost, cost[Year] = Courses[Year]), cost[cost])

 

Then create a meausre

sumx(filter(Courses, Courses[Student] <> blank()) , Courses[Cost])

 

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Hi,

Thanks for the suggestion. However, numbers are still adding up. Here's an example of what it's done. The flat rate for 2018-2019 is 10k. I have 5 students enrolled in the course Biology 101 that year. Since it's adding up, the costs are showing 50K.

 

Here's what I'm looking for. The flat rate for 2018-2019 is still 10k. Since "students" <> blank(), I want costs to show 10k. It does not matter how many students I have, it's the fact that I have at least 1 student that generates that cost.

I hope that I did not mix things up more with that explanation 😉

Thanks again, any comment will help a lot.

JS

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.