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
Syndicate_Admin
Administrator
Administrator

Change Column Subtotals in an Array

Hello everyone, my name is Roberto and I would like to consult if it is possible to change the calculation that is made in the Subtotal of a column.

In the following photograph the "Total" column shows the sum between the "PPTO" column and the "REAL" column, but what I would really like to see shown is the subtraction between "PPTO" and "REAL"

Roberto_Guerra_0-1665071159866.png

The "total" column does not come from a measurement and does not come from a calculation in a table, but from the functions of Power Bi.

Roberto_Guerra_1-1665071911328.png

So, is it feasible to be able to change within this functionality that is time to add, perform a subtraction?

Another alternative that I have thought of, is to create a measure that adds the income by PPTO including filters and create a measure that adds the REAL income applying filters and these two measures are subtracted. But I don't know how to apply filters to the SUM function.

I am grateful for the help and guidance.

2 REPLIES 2
jgeddes
Super User
Super User

You are on the right path when you mention creating individual measures.
Using the CALCULATE function you can set the filters you desire. It is definitely worth reading up on how CALCULATE works.
Very quickly in your case you will need something like;
PPTO Sum =
CALCULATE(
SUM([columnThatYouWantToSum]),
[columnThatContainsPPTO] = "PPTO"
)

Hope this gets you pointed in the right direction.




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Thank you very much for the advice and help.

I was able to search for information about CALCULATE and it helped me a lot, I was able to create a measurement:

Example measure 2 = CALCULATE(SUM(CONSOLIDADO_PPTO_VS_REAL[HABER]), CONSOLIDADO_PPTO_VS_REAL[CATEGORY] = "PPTO") - CALCULATE(SUM(CONSOLIDADO_PPTO_VS_REAL[HABER]), CONSOLIDADO_PPTO_VS_REAL[CATEGORY] = "REAL")
Through the filters, I can select the rows that correspond to be considered:
Roberto_Guerra_0-1665155704904.png

Finally, I have a "Card" on which I can place the difference between "PPTO" and "REAL":

Roberto_Guerra_1-1665155818644.png

The next challenge is to be able to incorporate this new measure as a column at the end of the matrix.

Thank you very much.

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.