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
Anonymous
Not applicable

LookupValue as a Calculated Measure

Hi all, 

 

I created calculated column where I wrote the following formula. I use the Lookup Value function with Indexes there. this formula works well, but I want to ask if you could write me how to write the same formula but for "Calculated Measures" ? Thank you

Patrik1994_0-1669725998004.png

 

Weighted ABS Error Statistical Lag 1 last 3M = ('LAG 1 Sales History'[ABS Error Statistical Lag 1]*0.6 + (LOOKUPVALUE(

'LAG 1 Sales History'[ABS Error Statistical Lag 1],

'LAG 1 Sales History'[Index],

'LAG 1 Sales History'[Index] - 1))

*0.25 + (LOOKUPVALUE(

'LAG 1 Sales History'[ABS Error Statistical Lag 1],

'LAG 1 Sales History'[Index],

'LAG 1 Sales History'[Index] - 2))

*0.15)/1

 

1 ACCEPTED SOLUTION

Hi @Anonymous ,

Please refer to my pbix file to see if it helps you.

Create a measure.

Measure =
VAR _3 =
    CALCULATE (
        MAX ( 'Table'[ABS Error] ),
        FILTER (
            ALL ( 'Table' ),
            'Table'[DFU] = SELECTEDVALUE ( 'Table'[DFU] )
                && 'Table'[index]
                    = SELECTEDVALUE ( 'Table'[index] ) - 2
        )
    )
VAR _2 =
    CALCULATE (
        MAX ( 'Table'[ABS Error] ),
        FILTER (
            ALL ( 'Table' ),
            'Table'[DFU] = SELECTEDVALUE ( 'Table'[DFU] )
                && 'Table'[index]
                    = SELECTEDVALUE ( 'Table'[index] ) - 1
        )
    )
VAR _1 =
    CALCULATE (
        MAX ( 'Table'[ABS Error] ),
        FILTER (
            ALL ( 'Table' ),
            'Table'[DFU] = SELECTEDVALUE ( 'Table'[DFU] )
                && 'Table'[index] = SELECTEDVALUE ( 'Table'[index] )
        )
    )
VAR _1RE = ( ( _3 * 0.6 ) + ( _2 * 0.25 ) + ( _1 * 0.15 ) ) / 1
RETURN
    IF ( MAX ( 'Table'[index] ) <= 1, BLANK (), _1RE )

vpollymsft_0-1669857314919.png

 

 

If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .

 

Best Regards
Community Support Team _ Polly

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

5 REPLIES 5
v-rongtiep-msft
Community Support
Community Support

Hi @Anonymous ,

Please have a try.

Create a measure.

Weighted ABS Error Statistical Lag 1 last 3M =
MAX ( 'LAG 1 Sales History'[ABS Error Statistical Lag 1] ) * 0.6
    + (
        LOOKUPVALUE (
            'LAG 1 Sales History'[ABS Error Statistical Lag 1],
            'LAG 1 Sales History'[Index], 'LAG 1 Sales History'[Index] - 1
        ) * 0.25
            + (
                LOOKUPVALUE (
                    'LAG 1 Sales History'[ABS Error Statistical Lag 1],
                    'LAG 1 Sales History'[Index], 'LAG 1 Sales History'[Index] - 2
                )
            ) * 0.15
    ) / 1

 

If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .

 

Best Regards
Community Support Team _ Polly

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

Anonymous
Not applicable

A small example in Excel of what we are trying to do in PBi with the help of indexes. 

Is there any other way to achieve this? But only Calculated Measure, because Calculated Column takes a lot of memory

Thanks



Patrik1994_0-1669804848683.pngPatrik1994_1-1669804860392.png

Patrik1994_2-1669804875893.png

 

Hi @Anonymous ,

Please refer to my pbix file to see if it helps you.

Create a measure.

Measure =
VAR _3 =
    CALCULATE (
        MAX ( 'Table'[ABS Error] ),
        FILTER (
            ALL ( 'Table' ),
            'Table'[DFU] = SELECTEDVALUE ( 'Table'[DFU] )
                && 'Table'[index]
                    = SELECTEDVALUE ( 'Table'[index] ) - 2
        )
    )
VAR _2 =
    CALCULATE (
        MAX ( 'Table'[ABS Error] ),
        FILTER (
            ALL ( 'Table' ),
            'Table'[DFU] = SELECTEDVALUE ( 'Table'[DFU] )
                && 'Table'[index]
                    = SELECTEDVALUE ( 'Table'[index] ) - 1
        )
    )
VAR _1 =
    CALCULATE (
        MAX ( 'Table'[ABS Error] ),
        FILTER (
            ALL ( 'Table' ),
            'Table'[DFU] = SELECTEDVALUE ( 'Table'[DFU] )
                && 'Table'[index] = SELECTEDVALUE ( 'Table'[index] )
        )
    )
VAR _1RE = ( ( _3 * 0.6 ) + ( _2 * 0.25 ) + ( _1 * 0.15 ) ) / 1
RETURN
    IF ( MAX ( 'Table'[index] ) <= 1, BLANK (), _1RE )

vpollymsft_0-1669857314919.png

 

 

If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .

 

Best Regards
Community Support Team _ Polly

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

Anonymous
Not applicable

thank you, it is working now 🙂

Anonymous
Not applicable

it is not working, it´s showing this error 

Patrik1994_0-1669804005605.png

 

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.