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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Anonymous
Not applicable

Sensor value frequency measure DAX

Good morning all,

I ask for your help with a measure.
I have a dataset with the following columns:

Image1.png

I would like to create an index based on the values ​​of a sensor. The sensor values ​​should be sorted in descending order. I managed to create the index with the RANKX function like in the following picture:

Image2.png

But unfortunately several sensor values ​​are repeated and the index does not continue to increase. Clearly, I would like to do as in this Excel:

Image3.png

Thank you in advance for your help,

 

Have a good day

 

Joel

1 ACCEPTED SOLUTION
v-jingzhang
Community Support
Community Support

Hi @Anonymous 

 

I notice that in your data, the rows with the same Sensor Value are sorted by dt ascendingly. So I will take dt into account to create a new sensor value in effect to be used in RANKX function. 

120204.jpg

 

Please refer to the following sample and try the DAX code to create an index column. 

Index = RANKX('Demo','Demo'[SensorValue] - VALUE(Demo[DateTime]) * 0.00000001,,0,Skip)

 

Multiplying a very small number to DateTime value and taking it away from Sensor Value will create a decimal number a little smaller than original Sensor Value but not repeated. So it can be used in RANKX function to make the Index value not repeated.

 120205.jpg

 

Kindly let me know if this works.


Community Support Team _ Jing Zhang
If this post helps, please consider Accept it as the solution to help other members find it.

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Thank you for your help @v-jingzhang ! I used an index in Power Query because I have a very large quantity of Data but thank you again !

v-jingzhang
Community Support
Community Support

Hi @Anonymous 

 

I notice that in your data, the rows with the same Sensor Value are sorted by dt ascendingly. So I will take dt into account to create a new sensor value in effect to be used in RANKX function. 

120204.jpg

 

Please refer to the following sample and try the DAX code to create an index column. 

Index = RANKX('Demo','Demo'[SensorValue] - VALUE(Demo[DateTime]) * 0.00000001,,0,Skip)

 

Multiplying a very small number to DateTime value and taking it away from Sensor Value will create a decimal number a little smaller than original Sensor Value but not repeated. So it can be used in RANKX function to make the Index value not repeated.

 120205.jpg

 

Kindly let me know if this works.


Community Support Team _ Jing Zhang
If this post helps, please consider Accept it as the solution to help other members find it.

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.