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
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
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.