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
Anonymous
Not applicable

Goal Seek/ add total of column to row

Gonqqq_1-1649075079492.png

Hi. So i have a simple matrix with different periods and a balance sheet. 


What i want is basically a goal seek: IF the total <> 0 , then add the value to this account row: Consolidado[Conta SAP] = 2610200100.

 

With this example: the 15.400.538 would add to the row where [Conta SAP] = 2610200100 is thus turning  total = 0.

 

 

Thanks in advance 🙂

 

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

Hi @Anonymous , 

I have create a simple sample, please refer to it to see if it helps you.

Create measures.

Measure_2 =
VAR SUMALL =
    SUMX ( ALL ( 'Table' ), 'Table'[Value] )
VAR _SUMX261 =
    CALCULATE (
        SUM ( 'Table'[Value] ),
        FILTER (
            ALL ( 'Table' ),
            MONTH ( 'Table'[date] ) = SELECTEDVALUE ( 'Table'[_MONTH] )
                && 'Table'[ID] <> "2610200100"
        )
    )
VAR _261 = _SUMX261 * -1
VAR _IF =
    IF (
        SUMALL <> 0
            && MAX ( 'Table'[ID] ) = "2610200100",
        _261,
        MAX ( 'Table'[Value] )
    )
RETURN
    _IF
Measure =
IF ( HASONEVALUE ( 'Table'[ID] ), [Measure_2], SUMX ( 'Table', [Measure_2] ) )

vpollymsft_1-1650533243966.png

 

 

If I have misunderstood your meaning, please provide your desired output and your pbix without privacy information.

 

Best Regards

Community Support Team _ Polly

 

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

1 REPLY 1
v-rongtiep-msft
Community Support
Community Support

Hi @Anonymous , 

I have create a simple sample, please refer to it to see if it helps you.

Create measures.

Measure_2 =
VAR SUMALL =
    SUMX ( ALL ( 'Table' ), 'Table'[Value] )
VAR _SUMX261 =
    CALCULATE (
        SUM ( 'Table'[Value] ),
        FILTER (
            ALL ( 'Table' ),
            MONTH ( 'Table'[date] ) = SELECTEDVALUE ( 'Table'[_MONTH] )
                && 'Table'[ID] <> "2610200100"
        )
    )
VAR _261 = _SUMX261 * -1
VAR _IF =
    IF (
        SUMALL <> 0
            && MAX ( 'Table'[ID] ) = "2610200100",
        _261,
        MAX ( 'Table'[Value] )
    )
RETURN
    _IF
Measure =
IF ( HASONEVALUE ( 'Table'[ID] ), [Measure_2], SUMX ( 'Table', [Measure_2] ) )

vpollymsft_1-1650533243966.png

 

 

If I have misunderstood your meaning, please provide your desired output and your pbix without privacy information.

 

Best Regards

Community Support Team _ Polly

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

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.

Top Solution Authors