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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.

Reply
mrupsidown
Helper I
Helper I

Compute column based on values of "similar" rows

mrupsidown_1-1626435652194.png

How would I go about computing the values of the "computed" column based on the following rules:

 

  • At least one of the rows (here 2) with id 123 has "A" as the value of the "field x" so it should display "YES" in the "computed" column for all rows with id 123.
  • Same for id 124.
  • None of the rows with id 125 have "A" as the value of the "field x" so it should display "NO" in the "computed" column.

Thanks in advance.

16 REPLIES 16
mwegener
Most Valuable Professional
Most Valuable Professional

Hi @mrupsidown ,

 

try this.

 

computed =
IF (
    CALCULATE ( MIN ( 'Table'[field x] ), REMOVEFILTERS ( 'Table'[field x] ) ) = "A",
    "YES",
    "NO"
)

 

Did I answer your question?
Please mark my post as solution, this will also help others.
Please give Kudos for support.

Marcus Wegener works as Full Stack Power BI Engineer at BI or DIE.
His mission is clear: "Get the most out of data, with Power BI."
twitter - LinkedIn - YouTube - website - podcast - Power BI Tutorials


That does NOT work. It will display "YES" for rows that have "A" and "NO" for other rows with the same id.

mwegener
Most Valuable Professional
Most Valuable Professional

Hi @mrupsidown ,

 

you used the DAX statement for a calculated column?

ComputedColumn.png

 

 

Did I answer your question?
Please mark my post as solution, this will also help others.
Please give Kudos for support.

Marcus Wegener works as Full Stack Power BI Engineer at BI or DIE.
His mission is clear: "Get the most out of data, with Power BI."
twitter - LinkedIn - YouTube - website - podcast - Power BI Tutorials


Yes I have used DAX. The only difference is that my "table" is a Query. Again, it will display "YES" for rows that have "A" and "NO" for other rows with the same id which is not my goal.

 

I don't even know how your example works without specifying the ID anywhere?

Adding a screenshot where you can see my table, column names and values (some stuff is blurred because I can't show this information) and the DAX function and its result. Instead of "A" which was an example, it must match the value "Global". Blurred rows have other values than "Global" in the "Modèle" column.

DAX-computed.png

mwegener
Most Valuable Professional
Most Valuable Professional

Hi @mrupsidown ,

 

I am not sure if we have understood each other correctly.
My question was whether the DAX Statement as a
1. DAX Measure
or
2. DAX Calculated Column
was used.

 

MeasureColumn.png

 

The statement was written for 2. DAX Calculated Column.

 

Did I answer your question?
Please mark my post as solution, this will also help others.
Please give Kudos for support.

Marcus Wegener works as Full Stack Power BI Engineer at BI or DIE.
His mission is clear: "Get the most out of data, with Power BI."
twitter - LinkedIn - YouTube - website - podcast - Power BI Tutorials


I select my table and click on "New column".

mwegener
Most Valuable Professional
Most Valuable Professional

If there are more columns, you can also try this one.

computed = 
IF(CALCULATE(MIN('Table'[field x]),ALLEXCEPT('Table','Table'[id])) = "A", "YES", "NO")

 

Did I answer your question?
Please mark my post as solution, this will also help others.
Please give Kudos for support.

Marcus Wegener works as Full Stack Power BI Engineer at BI or DIE.
His mission is clear: "Get the most out of data, with Power BI."
twitter - LinkedIn - YouTube - website - podcast - Power BI Tutorials


That doesn't work either. I was able to achieve what I wanted with the solution provided here: https://stackoverflow.com/a/68210381/1238965 but it uses an index column which is fine, except that there is apparently no way in PowerBi to hide a column in a table (yayy!).

mwegener
Most Valuable Professional
Most Valuable Professional

Hi @mrupsidown , you can hide columns in the field list.

Hide_Field.png

Did I answer your question?
Please mark my post as solution, this will also help others.
Please give Kudos for support.

Marcus Wegener works as Full Stack Power BI Engineer at BI or DIE.
His mission is clear: "Get the most out of data, with Power BI."
twitter - LinkedIn - YouTube - website - podcast - Power BI Tutorials


True. Somehow they still appear in my table after I hit "Hide", any idea?

mrupsidown_1-1627366209335.png

 

mwegener
Most Valuable Professional
Most Valuable Professional

@mrupsidown do you have the view hidden option active?

View_Hidden.png

Did I answer your question?
Please mark my post as solution, this will also help others.
Please give Kudos for support.

Marcus Wegener works as Full Stack Power BI Engineer at BI or DIE.
His mission is clear: "Get the most out of data, with Power BI."
twitter - LinkedIn - YouTube - website - podcast - Power BI Tutorials


Yes. And if I unselect "View hidden" then they disappear from the fields list. Not from the table...

mwegener
Most Valuable Professional
Most Valuable Professional

For this you have to remove the columns from the values field of the table visual.

ValuesField.png

Did I answer your question?
Please mark my post as solution, this will also help others.
Please give Kudos for support.

Marcus Wegener works as Full Stack Power BI Engineer at BI or DIE.
His mission is clear: "Get the most out of data, with Power BI."
twitter - LinkedIn - YouTube - website - podcast - Power BI Tutorials


No. Obviously this REMOVES the fields. I want to HIDE them, not REMOVE them. I need some fields for some calculations / bookmarks, but I don't want them to be DISPLAYED in my table.

 

Apparently, feature requests from YEARS ago, with HUNDREDS of votes still can't be implemented for whatever reason.

 

https://ideas.powerbi.com/ideas/idea/?ideaid=5f080970-9ddc-4d8b-8e51-8519eef2ce60

 

Hi @mrupsidown 

Have you solved this problem? If not, could you add more details?

I've tested the measure mentioned by mwegener, and it works! also, I don't think an index column is needed there.

besides, you don't need to worry that value can't be used for calculation if it's not in the table. It depends on the specific situation.

-

If yes, could you kindly accept the answer helpful as the solution (or kindly share your solution 😁). so the others can find it more quickly.
really appreciate!

-
Any question, please let me know. Looking forward to receiving your reply.

 

 

Best Regards,

Community Support Team _Tang

mwegener
Most Valuable Professional
Most Valuable Professional

I'm not sure if the fields really need to be present in the table visual to meet your requirements.
Can you describe/explain this more?

DAX calculations can be made based on fields that are not displayed in the visual. Also the visual can be filtered on fields that are not displayed in the visual.

 

Did I answer your question?
Please mark my post as solution, this will also help others.
Please give Kudos for support.

Marcus Wegener works as Full Stack Power BI Engineer at BI or DIE.
His mission is clear: "Get the most out of data, with Power BI."
twitter - LinkedIn - YouTube - website - podcast - Power BI Tutorials


Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.