Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago

Next lowest with multiple criteria

I have a fixed table (Table 1) with columns for ID, X and Y values. Each ID may have 20 X and Y values. I have a second table (Table 2) with a Column ID and a measured value. I'm trying to find the X value from table 1 that is the next lowest value based on the ID and measured value provided in Table 2. Once I find the X value I will need to find the Y value but I need to report them as separate measures.

Table 1                                       Table 2: Measure Value= 11 for ID 1            My result should be 10 for X and 20 for Y 

ID    X     Y

1     10   20

1      15   25

2      10   30

Thank you

3 Replies

  • foodd's avatar
    foodd
    Icon for Community Champion rankCommunity Champion

    Please provide your work-in-progress Power BI Desktop file (with sensitive information removed) that covers your issue or question completely in a usable format (not as a screenshot).

    https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-Forum/ba-p/963216

    Please show the expected outcome based on the sample data you provided.

    https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447...

    This allows members of the Forum to assess the state of the model, report layer, relationships, and any DAX applied.

  • Anonymous's avatar
    Anonymous
    Not applicable

    Table 1

    IPNX_VALUEVol (AF)
    10891015167.63
    10891035465.07
    10891055775.73
    10891076099.9
    10891096436.99
    10891116786.57
    10891137148.94
    10891157524.05
    10891177912.33
    10891198313.83
    10891218728.72
    10891239157.32
    10891259599.76
    108912710056.23
    108912910526.88
    108913111012.04
    108913311513.25
    108913512030.76
    1089135.0112033.35

     

    Table 2: I need a measurement that looks at IPN 1089 and Level 127.33 and finds the next lowest number from table 1 using the IPN and the Level as the filter. It should be 127 as a result since  it is less then 127.33 and has an IPN of 1089. This should be done for each of the IPN numbers.

    LineIPNDateLevel
    95310895/1/2023 0:00127.33
    95410915/1/2023 0:0032.58
    95510935/1/2023 0:0029.62
    95611235/1/2023 0:00171.63
    95711255/1/2023 0:0034.31
    95811275/1/2023 0:0010.91
    95939475/1/2023 0:000
    96011385/1/2023 0:0015.3
    96111405/1/2023 0:0014.77
    96211425/1/2023 0:0030.98
    96311445/1/2023 0:0032.67
    96411465/1/2023 0:0017.01
    96511645/1/2023 0:0016.99
    96611665/1/2023 0:0030.67
    96712585/1/2023 0:0074.02
    96812765/1/2023 0:0030.36
    96912785/1/2023 0:0060.22
  • Anonymous's avatar
    Anonymous
    Not applicable

    wont upload, wont let me copy as a table from excell.