January 15, 2024|developer tip|

how to create simple (and funny) semantic models that change its data with every refresh.

introduction.

When playing around with the automatic sync of import mode semantic models to OneLake, I realised I needed a semantic model that would change its data with every refresh. Now obviously, we usually have that kind of data already in place. However, for lab purposes, you might wanna consider a non-production, non-sensitive, slim, easy-to-query and simple-to-set-up data source. I came across the randomnumberapi that fulfilled these requirements. It returns a specified amount of numbers that randomly change with every API call. In this article, I wanna show you a simple setup on how to call this API in order to utilise its ever changing nature. Such a semantic model might come in handy i.e. in a scenario where you’d like to test the automation of data refreshes. Not that this blog post is going to change the world tremendously, but I still feel like it could help one or another. For some funnier API examples, feel free to check out the appendix, too.

prerequisites.

1. Power BI Desktop

1. What’s the goal?

The goal is to call the randomnumnerapi to retrieve new data with every API call imitating a data refresh:

2. The power query m script

Here the Power Query M script that you can paste into the advanced editor:

Copy to Clipboard

The API provides some customization options like the minimum and maximum as well as how many numbers shall be returned. I chose just 5 to keep the data as slim as possible.

3. Showtime

Below, the refresh in action. The numbers are altering with every refresh.

Before:

After:

end.

That’s it! Check out the appendix below for some other (maybe funnier) APIs. Disclaimer, these are all public APIs meaning I do not assume responsibility or liability for the content those APIs deliver.

appendix.

Here are other APIs that you can use and that might give some twist to your data. They also randomly change with every refresh. Let’s start with thecatapi:

Copy to Clipboard

And for the ones that consider themselves more a dog person, here thedogapi:

Copy to Clipboard

Or how about some jokes?

Copy to Clipboard

Leave A Comment