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
ianyyz
Helper I
Helper I

MEasure to take difference

 
 
highlighted 1786 in the pivot as an example
trying to see if its possible to take the difference between grand total of 118 minus the amount for that security ID found in the "summary" tab (table 1)
 
 
if i were doing this via formulas, id do a lookup based on security ID and return column A of the "summary" tab...then have another column take the difference between the lookup column and the grand total column
 
 
1 ACCEPTED SOLUTION
v-yiruan-msft
Community Support
Community Support

Hi @ianyyz ,

Assume that you have two tables 'pivot' and 'summary' in Power BI, you can follow the steps below to get it:

1. Create a calculated column in the table 'pivot'

Column =
VAR _amount =
    CALCULATE (
        SUM ( 'summary'[Amount] ),
        FILTER ( 'summary', 'summary'[sec id] = 'pivot'[sec id] )
    )
RETURN
    'pivot'[Grand Total] - _amount

2. Or create a measure as below and create a table using the field 'pivot'[sec id] and this new measure

Measure  =
VAR _amount =
    CALCULATE (
        SUM ( 'summary'[Amount] ),
        FILTER ( 'summary', 'summary'[sec id] = SELECTEDVALUE ( 'pivot'[sec id] ) )
    )
RETURN
    SUM ( 'pivot'[Grand Total] ) - _amount

Best Regards

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.

View solution in original post

3 REPLIES 3
v-yiruan-msft
Community Support
Community Support

Hi @ianyyz ,

Assume that you have two tables 'pivot' and 'summary' in Power BI, you can follow the steps below to get it:

1. Create a calculated column in the table 'pivot'

Column =
VAR _amount =
    CALCULATE (
        SUM ( 'summary'[Amount] ),
        FILTER ( 'summary', 'summary'[sec id] = 'pivot'[sec id] )
    )
RETURN
    'pivot'[Grand Total] - _amount

2. Or create a measure as below and create a table using the field 'pivot'[sec id] and this new measure

Measure  =
VAR _amount =
    CALCULATE (
        SUM ( 'summary'[Amount] ),
        FILTER ( 'summary', 'summary'[sec id] = SELECTEDVALUE ( 'pivot'[sec id] ) )
    )
RETURN
    SUM ( 'pivot'[Grand Total] ) - _amount

Best Regards

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.
ianyyz
Helper I
Helper I

anybody???

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.