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

Use a measure value of one row to populate all other rows

Hi,

 

Thanks for taking the time to go through this.

 

I have been breaking my head over this for the past few days and can't seem to find a valid solution. 

 

I have two tables - One with category headings (Category) and the other with component values (Component). I have one measure called 'Valid' that shows a value of 1 for the first nonblank value in the component table for the category. The result looks like this.

 

MonishaM_0-1649672679229.png

I have another measure called 'Market value' that returns a value based on some calculation.

 

MonishaM_1-1649672755176.png

 

Now my problem is with the measure 'Beta'. Beta for any component is calculated as the market value of the valid component of the category of the current component. Like in the above screenshot the valid component of the fruits category is Apples. So Beta is supposed to be 0.91. So the expected result is supposed to look like this:

 

MonishaM_2-1649673018637.png

 

But the output I get is as below:

MonishaM_3-1649673049680.png

 

The current formula for beta is as follows:

Beta:=
var fnb =FIRSTNONBLANK('Component'[Component],[valid])
RETURN CALCULATE( [Market Value],'Component'[Component]=fnb)

Can someone please help me with this? I have tried adding all filter, sumx but nothing seems to work.

 

Thanks & regards,
Monisha

 

 

1 ACCEPTED SOLUTION
MonishaM
Frequent Visitor

Finally figured out the answer to this and all it needed was an 'ALL()' 

 

Beta:=
var fnb =FIRSTNONBLANK(All('Component'[Component]),[valid])
RETURN CALCULATE( [Market Value],'Component'[Component]=fnb)

Hope this helps whoever is struggling with the this kind of issue.

View solution in original post

6 REPLIES 6
MonishaM
Frequent Visitor

Finally figured out the answer to this and all it needed was an 'ALL()' 

 

Beta:=
var fnb =FIRSTNONBLANK(All('Component'[Component]),[valid])
RETURN CALCULATE( [Market Value],'Component'[Component]=fnb)

Hope this helps whoever is struggling with the this kind of issue.

AntonioM
Solution Sage
Solution Sage

Hi, please give this a try

Beta = CALCULATE([Market Value], REMOVEFILTERS('Component'[Component]), Filter('Component', [valid] = 1))

For each component, that should find all components in its category, find which one is valid and then return its market value. 

 

If that still doesn't work please let me know. 

@AntonioM : Unfortunately that doesn't work. It is still only populating Beta value for Apples but this time with an incorrect value.

@MonishaM 

Ok, I've given this a try and it seems to work for me (although I've guessed a little bit how your model is set up). 

 

 

Beta = CALCULATE( CALCULATE([Market Value], FILTER(Component, [Valid] = 1)), ALL(Component[Component]))

 

 

If this also doesn't work please can you share some of your data model (tables, measures, relationships)

MonishaM
Frequent Visitor

@truptis : Without that condition how will I get the market value of Apples as the beta value of all the components under fruits?

truptis
Community Champion
Community Champion

Hi @MonishaM , This is happening because of this condition : 'Component'[Component]=fnb

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.