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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Anonymous
Not applicable

How to divide a column by its length

I need to create a Cumulative Distribution Plot in Power BI without knowing the number of rows the data contains. I followed the steps in this tutorial https://www.youtube.com/watch?v=oyo8OwTMM38&t=312s, but he knows that his data contains 5000 rows. How can I add a "Frequency" column that contains Index/length(Index)?

 

Norskeaksel_0-1625726252370.png

 

1 ACCEPTED SOLUTION
v-deddai1-msft
Community Support
Community Support

Hi @Anonymous ,

 

In dax you can use countrows(table) to get the rows number in your table. then you can creat a calculated column:

Frequency = Table[index]/COUNTROWS(Table)

In power query you can use the following :

 

 = Table.AddColumn(last step name,
    "Frequency",
    each [Index]/Table.RowCount(last step name)
)

 

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

 

Best Regards,

Dedmon Dai

View solution in original post

2 REPLIES 2
v-deddai1-msft
Community Support
Community Support

Hi @Anonymous ,

 

In dax you can use countrows(table) to get the rows number in your table. then you can creat a calculated column:

Frequency = Table[index]/COUNTROWS(Table)

In power query you can use the following :

 

 = Table.AddColumn(last step name,
    "Frequency",
    each [Index]/Table.RowCount(last step name)
)

 

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

 

Best Regards,

Dedmon Dai

HotChilli
Super User
Super User

In Power Query , List.Max(#"Added Index"[Index])   will give you the number of rows.  #"Added Index" is the name of the previous step

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

April Fabric Community Update

Fabric Community Update - April 2024

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