cancel
Showing results for
Did you mean:

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a \$100 discount. Register Now

## Get the date that corresponds to the maxium value

Hi,

I have run the following formula to get the maxium value for the given direction:

Direction1 max per EventFromTime =
MAXX(
KEEPFILTERS(VALUES('_demo_malls totalentrancehourly'[EventFromTime])),
CALCULATE(median('_demo_malls totalentrancehourly'[Direction1]))
)

However I need to also return the EventFromTime when this maximum happens. Any clue?

1 ACCEPTED SOLUTION
Community Champion

@duggy

```EventFromTime when maximum happens =
CALCULATE (
FIRSTNONBLANK ( '_demo_malls totalentrancehourly'[EventFromTime], 1 ),
FILTER (
VALUES ( '_demo_malls totalentrancehourly'[EventFromTime] ),
CALCULATE ( MEDIAN ( '_demo_malls totalentrancehourly'[Direction1] ) )
= CALCULATE (
[Direction1 max per EventFromTime],
VALUES ( '_demo_malls totalentrancehourly'[EventFromTime] )
)
)
)```

Good Luck!

2 REPLIES 2
Community Champion

@duggy

```EventFromTime when maximum happens =
CALCULATE (
FIRSTNONBLANK ( '_demo_malls totalentrancehourly'[EventFromTime], 1 ),
FILTER (
VALUES ( '_demo_malls totalentrancehourly'[EventFromTime] ),
CALCULATE ( MEDIAN ( '_demo_malls totalentrancehourly'[Direction1] ) )
= CALCULATE (
[Direction1 max per EventFromTime],
VALUES ( '_demo_malls totalentrancehourly'[EventFromTime] )
)
)
)```

Good Luck!

Rockstar!!! ive been battling with that for hours! Awesome thank you.

Announcements

#### Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

#### Power BI Monthly Update - February 2024

Check out the February 2024 Power BI update to learn about new features.

#### Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

#### Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.

Top Solution Authors
Top Kudoed Authors