How to split table by row in Power BI - powerbi

Simple question: I have a table that needs to be split into 2 tables via a row split and not the column split. How can I achieve this?
Thanks.

Duplicate the table, then delete the columns that you do not need from each of the copies.
To duplicate the table, open Power Query Editor by clicking on Edit Queries, right click your table and select Duplicate:
Then in each of the copies, right click on the header of the columns that you don't want, and select Remove. Alternatively, you can select the columns that you want to keep, and select Remove other columns.

Related

How to remove the empty rows in the table in PowerBI?

Hi all,
I have a table in PowerBI as shown in the screenshot above. I want to remove the rows in the table where column D is empty. So in the example above, the rows that should be removed are row7,8,9,10. In Power Query Editor, I'm only able to remove the rows if the entire row is empty.
May I know how should I remove row 7-10 in PowerBI? In future, if the data for row 7-10 in column D are available, then it will be restored back. Is this possible to achieve? Any help or advice will be greatly appreciated!
You can do as #Jeroen Mostert mentioned in his comment, within Power Query, or if you are just trying to display the table as a table visual in Power BI like this...
...then you could just filter the table visual by the column with blanks within Power BI without doing anything in Power Query.
To filter the table visual:
select the table visual
then, in the Filters pane, find the section about your column named Final, and then select "is not blank" from the drop-down selection below "Show items when the value"
then click Apply filter.
This screen snip shows the table visual selected and the Filters pane visible with "is not blank" selected in its drop-down.

Re-arrange bar chart in Power BI

I got a bar chart and I need to re-order the bars show in it. The bars show at which speed a person was driving and are currently sorted by the one that appears most often.
The data is imported in the structure:
The fields named *_id are used for filtering. What is shown in the bars is the count of the gemeten_snelheid column.
As shown in the bar chart the speeds are not sorted by "speed" but by count. Is it possible to re-order the bars so they are arranged by speed, and how would this be done?
I don't really know how to create a working example of this as the data is imported from a database connection, so if any more information is required feel free to ask.
You could create a new column and order by it, you could do it in sql, for example:
case when column1<30 then 1
when column1<40 then 2
when column1<50 then 3
column1_sort
Or you can do it in PowerBI, you could Add Column -> Conditional Column and write your Ifs. Or you can when in PowerBI desktop right click table, select New column and write something like:
Column_sort = if([Column1]="<30",1,if([Column1]="<40",2,if([Column1]="<50",3,4)))
Then select your not sorted column (Column1) and under Column tools there is Sort by column, and from there select column1_sort
Did you tried this below option? Here I am getting your expected output-

Is there a formula to automatically drag data form many columns into a new column?

I would like to create a new table in Power Query (for Power BI) with 2 columns that contain data from other columns. These 2 new columns should have the data from the source columns stacked one over eachother. Attached is a link with the desired results.
https://ibb.co/dP1k6pd
What I need is a formula that will automatically update the new columns (ID and cars).
Have not tried anything as I do not have any ideas how to do this yet.
No code provided.
The new columns should automatically drag the data from the source columns and organize it vertically.
Best regards,
Denis
Go to the Edit Queries then select all 3 columns at the header (with shift and mouse click) then go to Transform > Unpivot Columns > Unpivot Only Selected Columns.
You can remove the middle column now and change the column headers to get your desired result.

Dynamic column names in power bi

I have imported an excel file for creating a PBI report. In this excel, there is a cell which contains a date. I want to create columns on the basis of this cell.
Like if the cell contains 01/04/2017 then I would like to generate column names like Apr-17, May-17, ..., Dec-17, Jan-18,..., Mar-18.
If there any way to do this?
I'd say just create a step by step procedure in edit query to pivot the table.
First you'd only get distinct values, then pivot and then promote to headers.
I don't think you need a column per month.
1) Create a query to import your file
2) In Query Editor, select the query, then "Transform" -> "Use First Row As Headers"
3) "Transform" -> "Unpivot Columns"
4) Rename columns as desired
Now you have a table in a comparable/filterable/queryable form. You didn't specify what you need it for but having a column per month won't work well (for various reasons). PowerBi doesn't work quite like excel.
If you really wanted a column per month, you could stop at step 2) but I would advise against it.

How to add external data as new columns in Power Query?

Today is my first day to use PowerBI 2.0 Desktop.
Is there any way to add new columns from external data into the existing table in my PowerBI?
Or is there anyway to add new columns from another table in PowerBI?
It seems that, in PowerQuery, all the tabs Add Custom Column, Add Index Column and Duplicate Column are all using the existing columns in the same table.....
You can use Merge Queries to join together two queries, which will let you bring in the other table's columns.
Also, Add Custom Column accepts an arbitrary expression, so you can reference other tables in that expression. For example, if Table1 and Table2 had the same number of rows, I could copy over Table2's column by doing the following:
Add an Index Column. Let's call it Index.
Add a Custom Column with the following expression: Table2[ColumnName]{[Index]}