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
saqster
Regular Visitor

HELP- Trouble looking up values in adjacent columns of selected row

Hello, I'm sure I have a simple problem but cant seem to solve it for days now. Let me explain

The tbl looks like following-

 

DateTime                Ot-Ltm    Max(Ot-Ltm)     Htm-Ot         Max(Htm-Ot)
8/24/2015 9:32        27.9       27.9                  -9.2              0.6
8/24/2015 9:33        26.2       27.9                  -11.7            0.6
8/24/2015 9:44        30.8       30.8                  5.7               5.7
8/24/2015 9:45       17.3        30.8                  3.2               5.7
8/24/2015 9:46       2.6         30.8                   2.1              5.7
8/24/2015 9:47       2.7         30.8                   2.7              5.7
8/24/2015 9:48       -1.2        30.8                  4.1               5.7
8/24/2015 9:49       1.5         30.8                  1.9               5.7
8/24/2015 9:50       1.7         30.8                  1.1               5.7
8/24/2015 9:51       0.5         30.8                  2.6               5.7
8/24/2015 9:52       5            30.8                  0.5               5.7
8/24/2015 9:53       12.4       30.8                  -0.6              5.7
8/24/2015 9:54       4.9         30.8                  -1.8              5.7
8/24/2015 9:55       3.1         30.8                  2.8               5.7
8/24/2015 9:56       -0.9        30.8                  3.1               5.7
8/24/2015 9:57       -2.8        30.8                  6.7               6.7      <-----------------
8/24/2015 9:58       -3.9        30.8                  6.7               6.7
8/24/2015 9:59       -2.1        30.8                  5.6               6.7

Both the MAX() columns are simply "hiwater marks" for the columns on their Left.

 

All I want to is create MEASURES that do the following-

 

1) Get Maximum largest Value for last column: Max(Htm-Ot), which in the case above is 6.7

 

     MaxINC :=MAXA(Table1[Max(Htm-Ot)])    ------- this works, gives me 6.7 as marked above

 

2) Lookup the corresponding Row values (DateTime, etc) for the 1st time the highest values in column [Max(Htm-Ot)] is hit.

so in the table above 6.7 is hit at "8/24/2015 9:57" the first time, and the measure shoud return "8/24/2015 9:57" .

 

But I cant seem to make it work, I tried both of the following Measures but none work as expected:

 

MaxExcTIME1 :=

 

CALCULATE (

    MINA ( [DateTime] ),

    FILTER (

        'Table1',

        [Max (Htm-Ot)] = [MaxINC]

    )

)

 

MaxExcTIME2 := lookupvalue( [DateTime],Table1[Max(Htm-Ot)],  [NGapMaxExc])

 

 

PLS HELP on how to write these measures. THANKS.

 

1 ACCEPTED SOLUTION

Assuming those max field are not measures, write following measure to get the date

 

Measure = Calculate(Min(Table1[DateTime]), Filter(All(Table1),Table1[Max(Htm-Ot)]=max(Table1[Max(Htm-Ot)])))


Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

View solution in original post

4 REPLIES 4
parry2k
Super User
Super User

@saqster Quick question, are those max columns are part of data set or those are measures you created?



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

The max columns are part of data, not Measures. Thanks

 

Assuming those max field are not measures, write following measure to get the date

 

Measure = Calculate(Min(Table1[DateTime]), Filter(All(Table1),Table1[Max(Htm-Ot)]=max(Table1[Max(Htm-Ot)])))


Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Awesome, Thank you very much! Smiley Very Happy

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.