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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Anonymous
Not applicable

INDEX for table with DAX

Hello ,

   I want to create index wiht DAX for following table. But I could not create a column  because working in Direct Query. That why I need a different solution.
   The index that will be created with DAX must be ranked with Quanty and sales prices. Sales price and Quantity are directly proportional; when one of them increases other one also increases.

 

                                                        

The outout of DAXThe outout of DAX

Power BI VısualPower BI Vısual

7 REPLIES 7
v-zhenbw-msft
Community Support
Community Support

Hi @Anonymous ,

 

We can use the following measure to get an index.

 

index = 
IF (
    HASONEVALUE ( 'Table'[CHAN] ), 
    RANKX ( ALLSELECTED ( 'Table'[CHAN], 'Table'[QUANTY] ), [SALES PRICE] )
)

 

The result like this,

 

index 1.jpg

 

Best regards,

 

Community Support Team _ zhenbw

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Anonymous
Not applicable

Hi @v-zhenbw-msft ,

  Could yo share pbix with me?
  It seems like to work but in my desktop does not works, although I checked my code a lot.

 

Thanks, Br

Greg_Deckler
Community Champion
Community Champion

Not exactly sure I get it. But, maybe check out 

 
To *Bleep* with RANKX!



Follow on LinkedIn
@ 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!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...
amitchandak
Super User
Super User

@Anonymous , Not very clear you want to do.

 

For Rank Refer these links
https://radacad.com/how-to-use-rankx-in-dax-part-2-of-3-calculated-measures
https://radacad.com/how-to-use-rankx-in-dax-part-3-of-3-the-finale

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
parry2k
Super User
Super User

@Anonymous so what exactly you are after, an Index column? How you are planning to use it? I guess sales price is a measure?



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Anonymous
Not applicable

Yes,Sales price is measure. I want to add index column for power bi visual on above.
az38
Community Champion
Community Champion

Hi @Anonymous 

according the radacad RANKX bible from @amitchandak link, you can try to create a measure like

	RANKX(
		ALL('Table') ,
		CALCULATE(
			SUM('Table'[Sales Price])
			)
	)

do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors