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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
yaparlasreenath
Regular Visitor

I need to create index column on the visual

actual result

yaparlasreenath_0-1649851320237.png

desired result 

yaparlasreenath_2-1649852030996.png

 

i need dynamic index column on the visual based on price column  (price column should be in ascending order)

 

8 REPLIES 8
v-jayw-msft
Community Support
Community Support

Hi @yaparlasreenath ,

 

You could also use countrows() function.

column:

countrow_ = CALCULATE(COUNTROWS('Table'),FILTER('Table','Table'[price]<=EARLIER('Table'[price])))
vjaywmsft_0-1650446653178.png

Measure:

count_rows = CALCULATE(COUNTROWS('Table'),FILTER(ALLSELECTED('Table'),'Table'[price]<=MAX('Table'[price])))
vjaywmsft_2-1650446800010.png

 

Best Regards,

Jay

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

Hi jayw ,

I don't need index numbers based backend whole dataset, i need dynamic index for example
if i apply any filter the index value is recalculate

Hi @yaparlasreenath ,

If you are going to create  a column, it will not be dynamically indexing the records based on your selections.

 

The Only way to get dynamic nature to your index values is by creating measures.

You can check out the below two sugesstions on this

https://community.powerbi.com/t5/Desktop/I-need-to-create-index-column-on-the-visual/m-p/2465967#

 

https://community.powerbi.com/t5/Desktop/I-need-to-create-index-column-on-the-visual/m-p/2465967#

 

Regards,

 

Greg_Deckler
Super User
Super User

In addition the @Thejeswar you could also use the Mythical DAX Index. The Mythical DAX Index - Microsoft Power BI Community


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Mastering Power BI 2nd Edition

DAX is easy, CALCULATE makes DAX hard...

@Greg_Deckler ,

Sure let me check that out. Thanks!!

Thejeswar
Resident Rockstar
Resident Rockstar

Hi @yaparlasreenath ,

You need to create a Rank based on the Price and Use this Rank Measure as your index column in the visual.

 

index :=
RANKX ( ALL (Table), 'Table'[price] ,, ASC)
 
When used in a measure
index :=
RANKX ( ALL (Table), CALCULATE(SUM('Table'[price])) ,, ASC)

Hi tejeswar , when i try to implement the same logi i got below error.

 

A single value for column 'Final Unit price with zeros' in table 'udm_sales_fact' cannot be determined. This can happen when a measure formula refers to a column that contains many values without specifying an aggr

Hi @yaparedd ,

It clearly tells you what the error is!!

 

In a measure you have to use aggregate for a column. Like SUM(Table[Price]).

May be you can try this

index :=
RANKX ( ALL (Table), CALCULATE(SUM('Table'[price])) ,, ASC)
 
*Updated my previous reply as well

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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