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

Level up your Power BI skills this month - build one visual each week and tell better stories with data! Get started

Reply
wilson_smyth
Post Patron
Post Patron

matrix adding extra column values when using certain measures.

I have a fact table showing direct and indirect costs by year.

e.g. each project can have direct and inidrect costs for each year of the project.

Some projects may be 2 years, some may be 5 years in length.


I am trying to calculate total costs (sum of direct and indirect, excluding the year), but for the year, teh year in the column header is adding columns for all years, even if the select project only has a small number of years.

 

In this example proj a has 2 years, but when i do my total cost calculation, the matrix adds a column for all years.

e.g. for proj a there should be year 1 & year 2 total costs, direct and indirect, but im seeing 7 years of them as another project has 7 years.


The pic below shows what i want to get (1st table) and what i actually get (2nd table)

Capture.JPG

 

Appreciate any help. An example pbix is located here

https://1drv.ms/u/s!AgldA0VQfPV9hNBEkjNN5mdorq779A

1 ACCEPTED SOLUTION
v-chuncz-msft
Community Support
Community Support

@wilson_smyth,

 

You may add IF.

 

IF (
    HASONEVALUE ( factBudgets[Year] ),

 

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

View solution in original post

2 REPLIES 2
v-chuncz-msft
Community Support
Community Support

@wilson_smyth,

 

You may add IF.

 

IF (
    HASONEVALUE ( factBudgets[Year] ),

 

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

@v-chuncz-msft

 

Thank you, that works! 

I dont undetstand how it works however, could i trouble you for an explination?

Also, although it was not a requirement, the measure now only works on the matrix now, it wont work on a table, is it a case i need a seperate measure for a table and for a matrix in this situation?

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

Check out the April 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.