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

Next up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now

Reply
lhern_ndez
Helper I
Helper I

Measure: how to calculate difference of filtered row fields shown as column in a matrix

Hello,

 

I have a model where I produce the following Matrix:

 

Matrix.jpg

 

 

 

 

 

 

 

 

The rows, columns, values and filters are as follow:

 

Filters and columns.jpg

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

ACCOUNT CATEGORY is a column in a table, I add that field as column in the Matrix and then I filter: Operating Revenue and Operating Expense. I need to calculate the difference of those two filtered items: Operating Revenues - Operating Expenses and show it to the right.

 

Thanks in advance for the help!

 

Luis

 

1 ACCEPTED SOLUTION

Hi @lhern_ndez

 

Sorry for late reply.

 

Filter your measures for revenue and expence also - you will have to create a total of 6 measures

 

 

 

 

 

 

 

View solution in original post

11 REPLIES 11
kohlivinayak
Resolver I
Resolver I

I have faced the same situation and because it is a matrix you cannot just calculate a measure and add it in values.

Because Values will be repeated for all the categories resulting in displaying difference twice, one for revenue and one for expense, which is usually not required.

 

Then i tried to do it in the database by calculating and union it to the actual table but it resulted in the same thing getting two difference column.

Screen Shot 2018-07-04 at 12.52.32 PM.png

 

 

 

 

 

 

 

 

Only possible option i could find was create a measure for every column in the matrix. Eventually matrix will be gone and you will have a table.

 

This might not be your requirement but this was what we ended up with. I hope we get a better solution otherwise you can always use this one

 

sample i created

Screen Shot 2018-07-04 at 12.44.55 PM.png

 

 

 

 

 

 

 

 

Measures created for the above table

 

Actual Revenue = CALCULATE(MAX(Data[Actual]),FILTER(Data,Data[Category]="Revenue"))

Actual Expense = CALCULATE(MAX(Data[Actual]),FILTER(Data,Data[Category]="Expense"))

 

Actual Difference = [Actual Revenue] - [Actual Expense]

 

Simillarly you can create measures for other columns.

Hello kohlivinayak,

 

Thanks for your answer, the only detail is that in my case, Actual, Budget and ActVsBud are already measure (data coming from a related table, not the table that contains the column ACCOUNT CATEGORY, example as follow:

 

Actual = CALCULATE(sum(AspenData[Amount reporting]),FILTER(AspenData,AspenData[Accounting Book Type]="Actual"))

 

Thus, I see your measures are assuming the data are in the same table, is there any other possible solution?

 

I would like the table to look like this:

 

Table_NOI.jpg

 

 

 

 

 

 

 

Thanks,

 

Luis

 

can you share your tables with sample data.

if these tables are related measure should still work.

 

Hello,

 

This is the an extract from the table PSPAccount, which is basically a chart of accounts, there are different categories in the column ACCOUNT CATEGORY and as you can see, the are not values:

 

COA.jpg

 

 

 

 

 

 

 

 

 

 

This is an extract from the table AspenData, which are the transactions, the tables are related by the Partner Account Number, this is the table where the values (Column AMOUNT) are and the ACCOUNT CATEGORY field is not here, please note that Actual or Budget are in the column ACCOUNTING BOOK TYPE:

 

DATA.jpg

 

 

 

 

 

 

 

 

 

 

 

 

 

I tried your formulas but did not work as the values are in a different table, maybe you can tweak them?

 

Thanks for the help!

 

Luis

 

Hello @kohlivinayak

 

Any help will be appreciated!

 

Thanks!

 

Luis

Hi @lhern_ndez

 

Sorry for late reply.

 

Filter your measures for revenue and expence also - you will have to create a total of 6 measures

 

 

 

 

 

 

 

Hi @lhern_ndez

 

Please mark it as solution if it has worked.

Hello kohlivinayak,

 

Sorry for taking long, I was traveling.

 

I appreciate your help,

 

Luis

can you share your tables with sample data.

if these tables are related measure should still work.

Anonymous
Not applicable

Hi @lhern_ndez,

 

Please share some sample data/pbix file with expected result to help us clear your requirement.

 

Regards,

Xiaoxin Sheng

Hello 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Helpful resources

Announcements
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.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

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