![]() Reza is author of more than 14 books on Microsoft Business Intelligence, most of these books are published under Power BI category. Reza is also co-founder and co-organizer of Difinity conference in New Zealand, Power BI Summit, and Data Insight Summit. Reza is an active blogger and co-founder of RADACAD. He is a Microsoft Data Platform MVP for 12 continuous years (from 2011 till now) for his dedication in Microsoft BI. He has a BSc in Computer engineering he has more than 20 years’ experience in data analysis, BI, databases, programming, and development mostly on Microsoft technologies. Reza Rad is a Microsoft Regional Director, an Author, Trainer, Speaker and Consultant. Do you want to generate a random dataset and can’t get it working with Power Query? let me know down below in the comments. This was a very quick blog article about how to use List.Random to generate a random dataset of numbers. ![]() I might write about tricks to use those later on. However, you have to be careful when you use them on a list, because most of the times, query folding might happen, and then you get the same number for every row in the list after loading it into Power BI. There are two other random functions in Power Query: Number.Random and Number.RandomBetween, they both give you a random number. If you don’t like this to happen, and you want the list to be generated randomly only once, and doesn’t change with every function call, then you can specify the seed parameter: It means for every step, you will see the random list changing! ![]() You might also want to add a row number to the table, here is how you can do it: Under Add Column -> Index ColumnĪnd here is the dataset loaded into Power BI:Ĭhanging the Random List on Every Function Callīy default when you use List.Random with one parameter, it will recreate the list of random numbers after each function call. Now, we have a table with values up to 1000 Let’s say, for example, I want this to be a random number up to 1000. If you want this to be on a higher value, you can always multiply it with something. the table output now should have one column:Īs you see, the random number generated is between zero and one. When you convert a list to a table, you can split it based on a delimiter, which is not what we want here, so just click OK, on the “To Table” dialogue box. You can convert this list now to a table: You can even use this for generating a list of 10 million numbers! However, be careful when you load all that data into Power BI! It might consume all the memory □ In the Formula Bar, use the expression below = List.Random(10) If you don’t see the formula bar in Power Query Editor, this is where you can enable it: In the View tab, check the Formula Bar: To use this function to create a sample list, it is always easier to start from a blank query. You just specify the number of random numbers that you want to generate:įor example, if I want to create a list of ten random values, it would be List.Random(10). List.Random is one of those functions, which is very helpful. There are some functions that help with creating a random value. If you like to learn more about Power BI, read Power BI book from Rookie to Rock Star. You can use the generated output for building a sample dataset to work on with Power BI Desktop. In this short blog post, I’ll explain how to create this random list. There is a great and quick way that you can create a random list of numbers in Power BI using Power Query. I’ve been asked from one of my friends who were trying to create a random dataset for his presentation.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |