Fantasy Premier League API data Power BI - powerbi

Has anyone worked to get data set for Fantasy Premier League API?
I found the API https://fantasy.premierleague.com/api/bootstrap-static/
I am unable to get data into the Tables, not sure how to transform the data.

Hey I was having the same issue. In case you're still looking for a solution, here's how I was able to get data for the players:
Add Web source using the API link you've included.
In the Power Query Editor - Query Settings > Applied Steps, delete all automatic steps except the first step ("Source")
Go to "elements" row, select "List" ("elements" = players. if you're looking for data on teams instead, do the same steps but go to the "teams" row)
Right click "List" at the top of column 2, and click "To Table". Click "Ok"
To the right of "Column1" at the top, there should be an expand button. Click that and click "Ok"
This is likely the data you're looking for. You can now reorganize this data however you like and apply it.

Related

How to use a card as a filter in Power BI?

Is there a way to use a card as a slicer/filter in Power BI?
My report has two cards, "students_eligible" and "students_attended", as well as a table below them. I want to filter the table based on the cards. Meaning, if I click on the “students_eligible” card, then the table should only show the data related to “students_eligible”.
How can I accomplish this?
I’ve included an image below for context.
There is no direct method of using a Card as filter, you can't set it as one or assign a bookmark to an action on it.
What you need to is create for example a shape that sits on top of the visual, turn ofs the fill, background and boarder options, just to leave a transparent shape:
Then create two bookmarks, one with a filter for Students Eligible, and the other for Students Attended. You may have to create a third bookmark assigned to a button or other object to return to 'No filters'.
Assign the bookmark to the shape object and ensure that it is on top of the visual. So when the use no clicks on the card, it will click on the shape, which will then filter the page based on the bookmark.
You can if you wish, just use the Bookmark buttons rather than click on the card object, which may be better from a user point of view
Cards are not clickable by itself.
You can create a bookmark that holds data for the slicer value you want to choose. Also, create a button and add this bookmark to the buttons action property.
Place this button over the card and make the button completely transparent using the background and fill properties.
This provides a user experience of clicking on a card to filter
I recently developed the Slicer Button custom visual that allows one to use a card as a filter (more specifically as a "slicer"). Using a bookmark has some drawbacks and this custom visual allows a card to be used more similarly to a slicer visual.
Below if a YouTube video demonstrating how to setup and use the visual as well as a link to the GitHub repository.
Basic Setup & Use: https://www.youtube.com/watch?v=8x2QoE8M2yA&ab_channel=MattKocak
GitHub Repository: https://github.com/mattkocak/powerbi-visuals-slicerbutton
I'm happy to clarify anything that's unclear regarding the visual. I also have a blog post on the topic titled Turn your cards into slicers with the Slicer Button custom visual.

Showing a visualization with Parent Child/Successor Predecessor relationship

I wanted suggestions from the community as to which chart should be used to depict the Parent-Child/Successor-Predecessor relationship in Power BI. I'm using Azure boards as a data source. Here is my sample data source.
I want to show each work item id in the center and its Predecessor on the top left and successor on the bottom right. With that, I want to arrange my items based on iteration.
Here is how I'm trying to visualize my data.
I don't need links to the Microsoft Custom Visuals Page. I know that it exists. I'm expecting somebody to point out to a visual in the market place that could help me with my scenario.
Not sure if there any exact option for data presentation as per your design/requirement or not. But to serve the purpose, you can try with "Multi-row card" and the presentation will be something like below-
You can apply some Styling in the visual, but it will not like your sample requirement I guess :(
Here 2 column is basically 2 different "Multi-row card" visual.
In first visual, applied filter with Iteration = 1
In second visual, applied filter with Iteration = 2
For better presentation purpose, I replaced NULL value with a "-" in column "Predecessos ID" & "Source ID Title"

Power BI - Filter table by clicking on a card

In Power BI, I have a table that contains rows associated with one of five possible categories. I've created three cards that shows the count of rows for category 1, category 2, and the remaining three possible categories.
I would like to filter the table based on the card that I click on. How can I filter visuals by clicking on a card?
You can do this by using bookmarks. The following link walks you through how you can create a bookmark and use it:
https://learn.microsoft.com/en-us/power-bi/desktop-bookmarks
You should place buttons over each of the cards (Make sure you turn off the background and borders to make sure they look aesthetically right). Then all you have to do is assign bookmarks to each of the buttons to filter the corresponding data. Hope this helps.
I developed a custom visual called Slicer Button that can be used to essentially turn a card into a slicer/filter. The bookmark solution above has some drawbacks, such as affecting other filters, which this custom visual avoids.
Below is a GIF of the visual in use.
I've included a YouTube video demonstrating how to setup and use the visual and a link to the GitHub repository that hosts it.
Basic Setup & Use: https://www.youtube.com/watch?v=8x2QoE8M2yA&ab_channel=MattKocak
GitHub Repository: https://github.com/mattkocak/powerbi-visuals-slicerbutton
Let me know if you have any questions or comments. I'm happy to clarify anything. I also have a blog post on the topic titled Turn your cards into slicers with the Slicer Button custom visual.

In Query Editor, how to get details of a step?

I've done some basic things in a query editor via the user interface. For instance, I renamed a column. Now I'm going back to review, but I'm having a hard time figuring out where the details of the step are.
In Applied Steps, on the "Renamed Column", I can right click and go to properties, but it does not list the old and new column name. There is no gear/setting icon to the right. How do I figure out what the new and old column names are?
For the "remove top rows" step, I can click on the gear icon to the right, and get a box with the number of rows, and edit it. How can I do the same with other steps such as renaming columns?
Not all commands have a gear icon in the Applied Steps panel. The Advanced editor can be quite overwhelming at first.
To ease into things, go to the View ribbon and ensure that "Formula Bar" is ticked, like in the screenshot below. Now you can select a step in the Applied Steps panel and its formula shows in the formula bar, very much like in Excel. You can edit the formula and change parameters as you see fit.
You can expand the formula bar to show a few more rows, with the icon at the right of the formula bar.
The code behind the Query Editor is Power Query. Microsoft Power BI ports many useful / frequently-used functions to the user interface for easier / better user experience (but not all functions, obviously).
Therefore, if you want to find the details of a step, you can always go to the Advanced Editor and check out the original Power Query code to find the corresponding line of code. You can also modify the code directly if you understand Power Query.
Below is a screenshot of the Advanced Editor, where the Table.RenameColumns function in Power Query is highlighted, which is the same as Rename Column in Power BI:

aggregating data in power bi query editor

I have gone through this tutorial
https://powerbi.microsoft.com/en-us/documentation/powerbi-desktop-tutorial-analyzing-sales-data-from-excel-and-an-odata-feed/
and was having some issues at Task 4 - Step 1 that I have somewhat resolved but would like to find a better way to complete the task.
The issue of this is that the title of my graph is Sum of UnitsInStock by ProductName but I just want it to be "UnitsInStock by ProductName".
See image below:
Sum of UnitsInStock by ProductName
I think the issue is that in the tutorial link it has the "UnitsInStock" column is aggregated already (which you can see in the field pane) whereas I had to aggregate the data myself. I think to fix this I just have to aggregate the data in the query editor but I haven't been able to figure out how to do this.
If someone could point me in the right direction that would be great!
The button you want is Group By - it's on the Home ribbon in the central Transform section.
Select your grouping columns before hitting it, to preload them in the Group By window. I haven't followed that tutorial so you will need to decide what to select. Any column you don't select for Group By or aggregate (see below) will be removed by this Step.
In the bottom section of the Group By window, click the + button to add an aggregation, then choose Sum and choose your column (e.g. UnitsInStock ). You have to type the output column name.