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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
fingalbrad
Helper I
Helper I

return a value from another table based on the closest value of a column please help

HI I have a table called JP Outputs

 

POF

0.2234
0.2344
0.3455

 

And another table called Pof per Day

DAYS                                                           

 

DaysPoF Today
10.28
20.34
30.456

 

 

What I want to do is grab the POF from JP outputs and return the days that corresponds to the closest PoF using PoF Today

 

 

please plase please help

1 ACCEPTED SOLUTION
v-jianboli-msft
Community Support
Community Support

Hi @fingalbrad ,

 

Please try:

First, create a table visual of 'Pof per Day'

vjianbolimsft_0-1666144877240.png

Then apply the measure to visual level filter:

 

Flag =
VAR _a =
    ADDCOLUMNS (
        ALL ( 'Pof per Day' ),
        "Diff",
            MINX (
                'JP Outputs',
                ABS ( [POF] - CALCULATE ( MAX ( 'Pof per Day'[PoF Today] ) ) )
            )
    )
RETURN
    IF (
        MAX ( 'Pof per Day'[Days] )
            = MINX ( FILTER ( _a, [Diff] = MINX ( _a, [Diff] ) ), [Days] ),
        1,
        0
    )

vjianbolimsft_1-1666144949766.png

Final output:

vjianbolimsft_2-1666144967374.png

Best Regards,

Jianbo Li

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

1 REPLY 1
v-jianboli-msft
Community Support
Community Support

Hi @fingalbrad ,

 

Please try:

First, create a table visual of 'Pof per Day'

vjianbolimsft_0-1666144877240.png

Then apply the measure to visual level filter:

 

Flag =
VAR _a =
    ADDCOLUMNS (
        ALL ( 'Pof per Day' ),
        "Diff",
            MINX (
                'JP Outputs',
                ABS ( [POF] - CALCULATE ( MAX ( 'Pof per Day'[PoF Today] ) ) )
            )
    )
RETURN
    IF (
        MAX ( 'Pof per Day'[Days] )
            = MINX ( FILTER ( _a, [Diff] = MINX ( _a, [Diff] ) ), [Days] ),
        1,
        0
    )

vjianbolimsft_1-1666144949766.png

Final output:

vjianbolimsft_2-1666144967374.png

Best Regards,

Jianbo Li

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

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

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.