Showing results for 
Search instead for 
Did you mean: 
Frequent Visitor

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

Super User IV
Super User IV

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

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.

Super User IV
Super User IV

@MSTCR , Not very clear you want to do.


For Rank Refer these links

Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
Dashboard of My Blogs !! YouTube Channel !! Connect on Linkedin

Proud to be a Super User!

Frequent Visitor

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


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

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

do not hesitate to give a kudo to useful posts and mark solutions as solution
Super User IV
Super User IV

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

To *Bleep* with RANKX!


@ me in replies or I'll lose your thread!!!

I have a NEW book! 
DAX Cookbook from Packt
Over 120 DAX Recipes!

Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Community Support
Community Support



We can use the following measure to get an index.


index = 
IF (
    HASONEVALUE ( 'Table'[CHAN] ), 


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.

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

Helpful resources

Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Community Conference

Microsoft Power Platform Communities

Check out the Winners!


Create an end-to-end data and analytics solution

Learn how Power BI works with the latest Azure data and analytics innovations at the digital event with Microsoft CEO Satya Nadella.

Top Solution Authors
Top Kudoed Authors