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
tommuirwebb
Frequent Visitor

New measure to take the value from 1 row and apply it to all rows in the table

I have a simple table with columns Fruit and Cost. I would like to add a new measure which takes the value of Cost where Fruit="Pear" and apply it to all rows like so:

 

Fruit

Cost

New measure

Apple

1.0

1.2

Pear

1.2

1.2

Banana

0.9

1.2

Orange

0.8

1.2

 

 

1 ACCEPTED SOLUTION
v-cherch-msft
Employee
Employee

Hi @tommuirwebb 

You may try below measure:

Measure =
CALCULATE ( [Cost], FILTER ( ALL ( Table1 ), Table1[Fruit] = "Pear" ) )

Regards,

Community Support Team _ Cherie Chen
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

9 REPLIES 9
v-cherch-msft
Employee
Employee

Hi @tommuirwebb 

You may try below measure:

Measure =
CALCULATE ( [Cost], FILTER ( ALL ( Table1 ), Table1[Fruit] = "Pear" ) )

Regards,

Community Support Team _ Cherie Chen
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

This answer worked for me. Thanks so much for your help.

Anonymous
Not applicable

@tommuirwebb  - Create this Measure:

Pear Value = CALCULATE(MAX(FruitTable[Cost]), FruitTable[Fruit] = "Pear")

Hi natelpeterson, thanks for your reply. I had tried this already but this only applies the value for the row which contains Pear. I'd like the Cost value for Pear to apply to all rows in the table.

 

Anonymous
Not applicable

@tommuirwebb -

It's working here:

Pear.PNG

What is happening there?

Cheers,

Nathan

Ok, so I should start by saying I'm new to PowerBI so forgive me if I've missed something fundamental here. In my example, the Cost column is actually a Measure which is a calculated average price for each fruit. I'm guessing this is why I'm seeing different results?

Anonymous
Not applicable

@tommuirwebb  - Try this:

Pear Cost = CALCULATE([Cost], FruitTable[Fruit] = "Pear")

Thanks again, but unfortunately I get the same result. It only applies the value for the row which contains Pear.

Anonymous
Not applicable

@tommuirwebb  - could you share your pbix or a screenshot of the model diagram + the code of the Cost measure?

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.