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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
mco_jr
Frequent Visitor

How to calculate different values for each row filter

Hi, everyone!
I have the following table:

 

GerenciasScore
UN-BC3,34
SE3,65
PGPO2,96
GOPE3,16
GDRS3,24
ENGP3,25
ATP-MRL3,70
ATP-MLS2,77
ATP-BR-TVD3,24

 

I'm trying to calculate something using a different logic depending on 2 conditions, and these conditions is depending on the value of the row (the column "Gerencias" will dictate that). If the rows value is equal "UN-BC" I need to divide his "Score" by the average of the others rows. And for each other row (whatever the value is, it just needs to be different of "UN-BC"), I will divide the UN-BC "Score" by the own rows "Score".

Is that a way to do that? I already tried and can't figure out the best way to do that.

 

Thanks for your attention.

1 ACCEPTED SOLUTION

@mco_jr ,

try this measure,

Average Of Score =
VAR _averageWithoutUNBC =
    CALCULATE (
        AVERAGE ( 'Table'[Score] ),
        ALL ( 'Table' ),
        'Table'[Gerencias] <> "UN-BC"
    )
VAR _UNBCScoreDivison =
    DIVIDE (
        CALCULATE ( SUM ( 'Table'[Score] ), 'Table'[Gerencias] = "UN-BC" ),
        _averageWithoutUNBC
    )
VAR _UNBC =
    DIVIDE (
        CALCULATE ( MAX ( 'Table'[Score] ), 'Table'[Gerencias] = "UN-BC" ),
        MAX ( 'Table'[Score] )
    )
VAR _result =
    IF ( SELECTEDVALUE ( 'Table'[Gerencias] ) = "UN-BC", _UNBCScoreDivison, _UNBC )
RETURN
    _result




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

Proud to be a Super User!


LinkedIn


View solution in original post

5 REPLIES 5
Arul
Super User
Super User

@mco_jr ,

When you average of the other rows, Is that mean average = (a+b+c)/n? and for the the other rows, do you need divide UN-BC "Score" by other own scores at row level for other Gerencias which is not equal to UN-BC?





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

Proud to be a Super User!


LinkedIn


mco_jr
Frequent Visitor

Hi, mate!

Yeah, it's exactly that, and I need to show everything on a table. I need to calculate everything for each row individually.

@mco_jr ,

try this measure,

Average Of Score =
VAR _averageWithoutUNBC =
    CALCULATE (
        AVERAGE ( 'Table'[Score] ),
        ALL ( 'Table' ),
        'Table'[Gerencias] <> "UN-BC"
    )
VAR _UNBCScoreDivison =
    DIVIDE (
        CALCULATE ( SUM ( 'Table'[Score] ), 'Table'[Gerencias] = "UN-BC" ),
        _averageWithoutUNBC
    )
VAR _UNBC =
    DIVIDE (
        CALCULATE ( MAX ( 'Table'[Score] ), 'Table'[Gerencias] = "UN-BC" ),
        MAX ( 'Table'[Score] )
    )
VAR _result =
    IF ( SELECTEDVALUE ( 'Table'[Gerencias] ) = "UN-BC", _UNBCScoreDivison, _UNBC )
RETURN
    _result




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

Proud to be a Super User!


LinkedIn


mco_jr
Frequent Visitor

Ohh, I see now, the rows are getting empty, because this table is a summarized one, do you know if there is other solution or adjustment for this case? 

mco_jr
Frequent Visitor

Thanks for your answer, mate!

But the problem still the same, I can't see the result using a table visualization, all the rows disappear when I add the measure to the visualization.

 

Before: 

mco_jr_0-1692280201950.png

 

After:

mco_jr_1-1692280257911.png

 

I can't figure out a way to show up all the results, row by row...

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.