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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Lovebo95
Helper I
Helper I

Create custom column with a range of number

Hi,

 

I want to create a custom column in my table with a range of number like : 1;2;3;4;5;...;20

And if I have more than 20 records in my table it will add in my column a 0 or null value.

 

Thank you,

Regards,

Lovebo

1 ACCEPTED SOLUTION

@Lovebo95 ,

did not get it now. Are you looking for an index column? What is the logic behind 1,2,3 null

 

https://stackoverflow.com/questions/45715963/creating-an-index-column-for-power-bi

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

View solution in original post

9 REPLIES 9
Greg_Deckler
Community Champion
Community Champion

RANDBETWEEN??


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

@Lovebo95 , You can create table generateseries

using https://docs.microsoft.com/en-us/dax/generateseries-function

 

You can additional column as per need

Also refer

https://community.powerbi.com/t5/Community-Blog/Dynamic-TopN-made-easy-with-What-If-Parameter/ba-p/3...

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

Hi,

 

Generateseries() works good to create a new table, but to create a column in a table, it's always showing : 'A table of multiple values was supplied where a single value was expected'

 

Thanks for your help,

az38
Community Champion
Community Champion

@Lovebo95 

If I understand you correct:

1. Create an Index column started from 1 in Power Query Editor mode

Безымянный.png

 

2. In Report mode create a column like

ID = If(Table[Index] > 20, "null", Table[Index])

 


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

@Lovebo95 

give an example please


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

These are my table :

 

NameValue
Jean42

Mike

24
Paul22
Sara45
Bill14

 

And i would like to have something like with using something like generateseries(1;3;1) or directly by hand like {1;2;3}

 

NameValueID
Jean421

Mike

242
Paul223

Sara

45null
Bill14null

 

Is it clear ?

 

Thank you,

@Lovebo95 ,

did not get it now. Are you looking for an index column? What is the logic behind 1,2,3 null

 

https://stackoverflow.com/questions/45715963/creating-an-index-column-for-power-bi

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

Thank you,

 

That's work for my issue, but in fact I would like to know if it's possible to add some data in a column as we can add some data in a new table with the functionnality : 'Enter data'.

🙂

az38
Community Champion
Community Champion

@Lovebo95 

with enter data you can only add data manually without any formulas

to add column with logic you can use Query Editor Add columns functionality or DAX


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

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

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
Top Kudoed Authors