Power BI: Make a Table Visualization display all observations of a dataset - powerbi

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:

Related

Power Bi dealing with repeated instruments from REDCap

I have data like this:
It comes from REDCap, and as you may be able to tell, the data in the far right columns are repeated variables about each "protocol_title" (the far left column). I.e. "Love it" and "I want a disc instead" are both about "study 2"
I've imported the data into Power Bi and currently I have this:
What I'd like is for the top left visual to only have one row per study (with columns such as principal investigator and method of image transfer, i.e. columns that had data in the first row) and a visual on the lower left with all the right-most columns.
By switching the top visual from a table to a matrix I can kinda accomplish this:
But it adds a bunch of unnecessary columns. As an alternative I thought I could add a filter to the top visual that would filter to "redcap_event_name"=="protocol_information" which would only be those top rows.... but given the visuals are linked, if I do that it removes everything from the bottom visual. I'd like to keep the link between the visuals so that if I select "study2" in the top visual, it'll highlight relevant study 2 information in the bottom one.
So my question is: what's the best approach for making the visuals I want? Are there special settings for visuals? Do I need to do something to the data first in the query? How should I go about this?
You might want to rework you data structure. At first glance, your flat source table could be parsed into two tables :
Protocol
Survey
This can be done in PowerQuery.
For Protocol :
Select columns A to R.
Filter on redcap_event (?) starts by "protocol_info"
Delete empty rows
For Survey
Select columns A (to keep the protocol ID and be able to link both tables), T and U.
Filter on redcap_event (?) starts by "survey"
Delete empty rows.
You should end up with the two table with a one-to-many relationship between Protocol[Protocol_ID] (column A) and Survey[Protocol_ID] (same)
And it should make everything much easier: visuals, calculations...

Power BI Sort - Hiding the sort Column

In a Power BI table, I am trying to sort a table visual with a sort column which is average orders per customer. The data in the FACT table is at order level. When I try to hid the sort column in the table visual, I change the column name from Average orders per Customer to *, lock the filter and hide it and then pull the lines in so the column appears hidden. However due to the size of the contents of sort column ( row values) like 28878, this means the rows get fatter and it looks weird as the row height is blown up. Is there a way in Power BI to sort a table visual without having to add the sort column to it or a way where the rows go not get bigger due to the contents of the hidden sort column ( settings) ?
With respect to your last question, you can turn off the auto-sizing of the column in the Format panel on your visual.
You probably want Word wrap off too.
You can use a white shape to cover the undesired column:
Insert > Shapes
Format Shape > turn off Fill and Outline
Format > use Bring forward or Send backward to get the shape covering the visualization.

Replace blanks with zero in a matrix table in power BI

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.

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-

Sort visualization data using a column not displayed

This may look like a rookie question but in PowerBI, is it possible to
Not sort the data in a visualization (keep the natural order from the query)
If the answer to 1 is no, sort the data using a column that is not displayed in the visualization (for instance, sort table rows by an index that is not displayed in the table)
I found a workaround for charts (using the sort column as tooltip, the sort column becomes available in the available sorting columns) but I didn't for tables.
Edit: You can insert any column under Tooltips and it will be available for sorting in the same toolbar as in the screenshot below. Take a look at the answer here for further details.
Regarding:
Not sort the data in a visualization (keep the natural order from the
query)
I recently had problems with categorical data being sorted in a Visualization in a useless way, and not in the same way as in the query (or table in Power Query Editor). And If I'm not missing the point completely, you should be able to sort your data as you like by clicking the three dots in the top right of your visualization: