I have data which has a Payment Method, containing Advance and Royalty in rows. I want to split that in two columns Advance and Royalty.
This is my sample data:
I would like the output as attached in Power BI:
Welcome to Stack Overflow! Next time do not post your sample data as images, please!
You can add columns to your model in different ways - to add a conditional column or a custom column with M in Power Query Editor, or to add a calculated column or measure with DAX. In this case I will recommend you to add two conditional columns. Click on Transform data button in the ribbon to open Power Query Editor and then from Add Column tab click Conditional Column. Name it Advance, select Payment Method to be Advanceand set the output to beAdvance`:
Do the same again, but this time for Royalty payment type:
And you will get the desired result:
Related
I want to add in a table visualisation in POWER BI different Tooltips.
Each column of my table return sum(quantity) by date. I want to add the tooltips for each column to show details of the quantity. Taking into consideration the date of the current column.
Can you please help me? Thank you
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.
Can anyone help me add a subtotal row to existing data in power bi. Please see the sample output on the above snip.
If you're looking to add a subtotal to your matrix visualization in the report itself, you should use the paintbrush or customization icon on the frontend instead. There you're able to toggle subtotals and grand totals for both rows and columns. However, if it's important to have your backend data display the subtotal row, you can use M code in Power Query to "groupby" a column and summarize your data. See these links for sample code that have different techniques:
https://social.technet.microsoft.com/Forums/en-US/1891afde-7392-4d27-b920-dfd579837dc8/how-to-add-subtotal-in-a-row-in-power-query?forum=powerquery
https://community.powerbi.com/t5/Power-Query/Calculate-Subtotals-based-on-column-value-in-Power-Query-M/td-p/791788
I am using a power BI matrix report and I want to fill the blank values to 0 in the matrix tables. The data source would be a table from SQL server.
I am looking for options to fill the blank values with 0 using power BI? Any help would be greatly appreciated.
In a given table, (Blank) often comes from "null" in a column. Under Transform data, you can select the column you want to edit, then select "Replace Values" in the Home ribbon. Then it just works like a find and replace in any editor.
As mentioned in the comments, Blank is there for a reason and replacing to 0 may be a bad idea, depending on the data. In general, I try not to destroy any data unless entirely unavoidable.
Consider other solutions:
Like if you just don't want your calculated visualizations to show "(Blank)", do something like Measure = CALCULATE(<something>)+0 and it'll show a calculation of 0 if theres nothing in the column.
If you have a slicer showing a "(Blank)" category, just filter it out in the filters sidebar.
I've noticed that If you have a table in the Data Viewer in Power BI desktop such as this:
Then, if you insert the same table in a Table Visualization, the table will only display distinct values of the categories:
How can you set up a Table Visualization so that the data is displayed as it is in the Data Viewer where all observations are displayed?
Unfortunately, Power Bi Desktop currently does not have an option to display all observations in the Table Visualization(Oct 2018). I am optimistic the Power Bi team will correct this problem in a future release. If you feel strongly about this feature, please go to the Power Bi improvement Idea post and add your vote.
I'm answering this question to perhaps help others who come here looking for a work around until it gets implemented.
There is currently one work around that I know of: Add an index column to the data table, add this column to your table visualization, then shrink the column width of the index to hide the data. This is not a desirable work around, but might get you a solution in a pinch until the feature is implemented.
So for your example, to add an index column to your table, go to Edit Queries -> Add Column -> Index Column -> From 1
Then - back to your report, add the Index column to the Table Visualization and make sure you select Don't Summarize for the Index Column values tab pull down.
Once the index column is added to your table, and you sort by the index your table visualization should look like the following:
The last step is to hide the index column by shrinking the column width of the index column. Before you do this, you need to turn off word wrap for the columns and the values. Go to the paint roller and in Column Header and Values make sure you turn word wrap off:
then your final table will look like the following with all of the values required. The grey box is my mouse over the shrunk index column and wont show up for you unless you mouse over that area: