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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
alexa_0028
Resolver II
Resolver II

Get the measure value from other row with similar code as first row

Hi All,

I am trying to write the measure "Convert Sales To sterile " like below :

Logic: If name contains "S", then keep ASP measure as it is.
If it doesnt contains "S", then bring ASP of the other row which contains P. Code  as the row but has S in the end.

Example: How can I put the value 362.75 in the first row as well?

I am trying below measure but no luck so far.

Convert Sales To sterile =
CALCULATE([ASP (NTS|PU)],ALL('Sterile Map'[P. Code]),'Sterile Map'[new_product_column] IN VALUES('Sterile Map'[P. Code]))

 

alexa_0028_0-1643646849212.png

 



4 REPLIES 4
v-chenwuz-msft
Community Support
Community Support

Hi @alexa_0028 ,

 

Please share the code of [ASP (NTS|PU)].

Or you can refer this measure and do some change for your measure Convert Sales To sterile.

Measure =
VAR _nos =
    CALCULATE(
        SUM( 'Table'[B] ),
        FILTER(
            ALL( 'Table' ),
            [A] = CONCATENATE( SELECTEDVALUE( 'Table'[A] ), "s" )
        )
    )
VAR _withs =
    SUM( 'Table'[B] )
RETURN
    IF( ISBLANK( _nos ), _withs, _nos )

vchenwuzmsft_0-1644227906167.png


Best Regards

Community Support Team _ chenwu zhu

 

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

 

 

 

Hi @v-chenwuz-msft 
Thanks for the solution, but how can you fix the grand total? 
It should be 12 but not 10.

I tried this formula suiting to my situation and it worked but I have the same issue.Grand total didnt match with rows above.

Convert to Sales =
CALCULATE([ASP (NTS|PU)],ALLEXCEPT('Sterile Map','Sterile Map'[new_P.Code]),'Sterile Map'[P. Code] IN VALUES('Sterile Map'[new_P.Code]))

I tried -
IF(hasonefilter([P. Code]),convert_to_Sale,SUMX(keepfilter(VLAUES(P. Code])),convert_to_Sale) but no luck

alexa_0028
Resolver II
Resolver II

@Greg_Deckler 
I have formatted the question again, can you please help me?
I am not sure if Vlookup will work here as ASP is a measure.

Greg_Deckler
Community Champion
Community Champion

@alexa_0028 So normally you would use either LOOKUPVALUE or something like MAXX(FILTER(..., ...), ...) to emulate VLOOKUP. Hard to be more specific with the information provided.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

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.

Top Solution Authors