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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
sc_1991
Frequent Visitor

Issue with making Custom index for filtered data.

Hi, I have a large Dataset. I am trying to create a custom identifier column based on a few filters. 

 

Here is an example of what type of data I have (This is just a subset of the larger dataset, including the columns. I am just showing the columns that matter the most for my custom column)

 

ProgramTruckEngine TimeOil Hour
P1T11001.2
P1T120025
P1T130035
P1T150040
P1T180012
P1T190022
P1T1150010
P1T1160050
P1T210012
P1T220033
P1T230045
P1T23506
P1T240012
P2T31505
P2T325010
P2T335015
P2T340035

 

if you look at the table you can see I have multiple Programs and within each program, I have multiple trucks. 

 

What I want is a method to group the data for each truck within each program, sort the engine time in ascending order for each individual truck, and then examine the data presented in the Oil Hours column to identify instances where the current oil hour is lower than the previous data point. Subsequently, I would like to display this information in a new column. Please refer to the following example for clarification.

 

ProgramTruckEngine TimeOil HourCustom Marker
P1T11001.2A1
P1T120025A1
P1T130035A1
P1T150040A1
P1T180012A2
P1T190022A2
P1T1150010A3
P1T1160050A3
P1T210012A1
P1T220033A1
P1T230045A1
P1T23506A2
P1T240012A2
P2T31505A1
P2T325010A1
P2T335015A1
P2T340035A1

 

or color coding the regions 

 

sc_1991_0-1697749236391.png

 

So, to summarize

 

This formula does the following:

  1. It filters the data for each "Truck" within each "Program."

  2. Within each group, it sorts the data by "Engine Time" in ascending order.

  3. It then checks the "Oil Hour" values and repeats the "A" marker until the "Oil Hour" value decreases.

Thanks,

2 REPLIES 2
amitchandak
Super User
Super User

@sc_1991 , You can create Rank in DAX

 

Rankx(filter(Table, [program] = earlier([Program]) && [Truck] = earlier([Truck]) ), [Engine Time],,asc,dense)

Column Rank: https://www.youtube.com/watch?v=wDS_Vi4r9I4&list=PLPaNVDMhUXGaaqV92SBD5X2hk3TMNlHhb&index=39

 

Option in Power Query

Power BI and Power Query- Sub Category Rank and Index: https://youtu.be/tMBviW4-s4A

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

HI @amitchandak I could not get this solution to work. I think I am trying to do something that might not ve very possible for Power BI. Let me redifine my problem may be I nade my post very complex. 

I have a table that has Program, Truck, Engine Time and Oil Hour. Now within each program there are multiple trucks. Now what I want is when the user selects a particular truck. Somewhere in the backend I extrat the Engine Time and Oil Hours for that particular truck and then sort the Oil Hours based on the ascending sort of Engine Time. Now, for every instance where I see the present Oil Hours less than previous one I want to mark that as A1 and then keep increamenting everytime I see it for that truck. This Oil Hour data is cyclic in nature so I will see many other instances. So the marker would say A1,A2,A3 and so on. Do you think this is possible in Power BI ? 

 

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors