cancel
Showing results for
Did you mean:

Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.

Regular Visitor

## ranknumber in one day

Hi,

I should create a ranknumber but can not find how.  I have a list of vessels with their departure date and departure time.

Sometimes multiple vessels are leaving the same day. For that day I would like to give them a ranknumber in the order they left.

So the first that day, the second, ...; I should become the table as shown below.  Unfortunatly could not find the right manner or DAX code to do so.  Thanks to anybody who could help me out!

2 ACCEPTED SOLUTIONS
Community Champion

@314ter

You can use this calculated column

```RANK Column =
RANKX (
FILTER ( Table1, [Departure Date] = EARLIER ( [Departure Date] ) ),
[Departure Time],
,
ASC,
DENSE
)
```

Regards
Zubair

Community Champion

@314ter

It works when i use some sample rows like your data

Could your Departure Date (for each day) be different due to time element

If it it is use this MEASURE

```RANK =
RANKX (
FILTER (
Table1,
DATEVALUE ( [Deaprture Date] ) = DATEVALUE ( EARLIER ( [Deaprture Date] ) )
),
[Departure Time],
,
ASC,
DENSE
)
```

Regards
Zubair

4 REPLIES 4
Community Champion

@314ter

You can use this calculated column

```RANK Column =
RANKX (
FILTER ( Table1, [Departure Date] = EARLIER ( [Departure Date] ) ),
[Departure Time],
,
ASC,
DENSE
)
```

Regards
Zubair

Regular Visitor

Thanks, but unfortunately the output is only 1.

Community Champion

@314ter

It works when i use some sample rows like your data

Could your Departure Date (for each day) be different due to time element

If it it is use this MEASURE

```RANK =
RANKX (
FILTER (
Table1,
DATEVALUE ( [Deaprture Date] ) = DATEVALUE ( EARLIER ( [Deaprture Date] ) )
),
[Departure Time],
,
ASC,
DENSE
)
```

Regards
Zubair

Regular Visitor

Thanks a lot Zubair! Indeed, I send you this example but am acually working on another file (confidential info). There it didn't work, but it the example it does.  So yes must be something with the date value!  Thanks a lot!

Announcements

#### Power BI Monthly Update - November 2023

Check out the November 2023 Power BI update to learn about new features.

#### Fabric Community News unified experience

Read the latest Fabric Community announcements, including updates on Power BI, Synapse, Data Factory and Data Activator.

#### The largest Power BI and Fabric virtual conference

130+ sessions, 130+ speakers, Product managers, MVPs, and experts. All about Power BI and Fabric. Attend online or watch the recordings.

Top Solution Authors
Top Kudoed Authors