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

Convert calculated column to measure

Is it possible to convert the following calculated column to measure?

field widget = 
var minimum =
    LOOKUPVALUE('Virtual Table'[value], 'Virtual Table'[product_id],'Virtual Table'[product_id], 'Virtual Table'[type], "min")

var maximum =
    LOOKUPVALUE('Virtual Table'[value], 'Virtual Table'[product_id],'Virtual Table'[product_id], 'Virtual Table'[type], "max")

var diff =
    (maximum - minimum)
var mean = 
    DIVIDE((LOOKUPVALUE('Virtual Table'[value],'Virtual Table'[product_id],'Virtual Table'[product_id],'Virtual Table'[type],"mean")-minimum),diff)
var wavg = 
    DIVIDE((LOOKUPVALUE('Virtual Table'[value], 'Virtual Table'[product_id],'Virtual Table'[product_id], 'Virtual Table'[type], "wavg")-minimum),diff)
var pp =
    DIVIDE((LOOKUPVALUE('Virtual Table'[value], 'Virtual Table'[product_id],'Virtual Table'[product_id], 'Virtual Table'[type], "pp")-minimum),diff)

RETURN
        ABS(IF('Virtual Table'[type] = "mean",mean,
            IF('Virtual Table'[type] = "wavg",wavg,
                IF('Virtual Table'[type] = "min",0,
                    IF('Virtual Table'[type] = "max",1,
                        IF('Virtual Table'[type] = "product_price",pp, BLANK()))))))
1 ACCEPTED SOLUTION
johnt75
Super User
Super User

I think you can reuse this with just a few changes. In each of your LOOKUPVALUE calls, wrap the third parameter in SELECTEDVALUE(), and do the same thing in each of the IF statements - replace 'Virtual Table'[type] with SELECTEDVALUE('Virtual Table'[type])

View solution in original post

1 REPLY 1
johnt75
Super User
Super User

I think you can reuse this with just a few changes. In each of your LOOKUPVALUE calls, wrap the third parameter in SELECTEDVALUE(), and do the same thing in each of the IF statements - replace 'Virtual Table'[type] with SELECTEDVALUE('Virtual Table'[type])

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.