How To Pivot Table Visualizer in Power BI - powerbi

I have some measures and a calculated field from a dataset that show me the following:
The highlighted row/column is just to show the different output.
This works great except that the data needs pivoting to looks like this:
I have tried to do this with a Matrix Visual but it seems you can not put Measures in for the Rows. I have looked into it on the web and nothing is really doing what I need.

You can put your months as columns and then go to the Format pane, Values section, and toggle the option Show on rows:

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...

How to disable the sorting axis option in Power BI line chart?

I have some data coming from a SQL Server query and the table looks as shown in the next figure:
If I display this in an Excel chart, it looks like the following picture:
As it can be noticed, in Excel the chart displays the data according to the order they have in the table.
When I tried to show this data in a Power BI line chart, it looks like the following picture:
Because the data is sorted by the occupancy values.
I do not want the data sorted as Power BI does. I want the data in the same way they are in the table. Any ideas about how can I do to disable the sorting axis option?
This should be rather simple.
Just click on the field that is currently used for the sorting, once you click it, the sort goes away completely.
See demo:
Sort actived:
Sort deactivated (clicking on Count of Status):

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-

Merge or combine two columns in power bi

I am not sure if my title is correct one, but here is the deal:
I want to make a matrix visualization in Power Bi Desktop. I have fields: ARTICLE_ID and ARTICLE_NAME.
I would like to have both those fields in COLUMNS position in matrix data view. And I need them to be in one row, no need to drill down... because it is one and the same thing...
I need to have ARTICLE_ID and ARTICLE_NAME as two separate columns on the same level. without drilling. And also, I dont want to use concatenation or merging into some third column. is that possible? thanks
1) I started with this sample data.
2) I created a matrix and configured it as shown in the image below.
3) I clicked the forked arrows to show all levels.
4) In the Rows section of the formatting pane, I turned off "Stepped layout".
5) In the Subtotals section, I turned off "Row subtotals".
I don't know if this is exactly what you are looking for, but I think it is the closest I can come up with since you don't want to concatenate the columns together.
If they are from the same table then just drag and drop them into the columns.
The way a matrix works from my understanding in PowerBI is;
Rows are just the headings/categories of the values.
You might need to also go into the format tab, values, and make sure show on rows is on.
For example, let's say our value headings are rainy days and sunny days.
Your columns are months.
The rows will be the 2 categories.
The values will be the values.
As concatenation and "&" does not work in Power BI directquery you can use the below one:
[New_column_name] = if((table_name[column_name]="A" && table_name[column_name]="B"),"AB","NA")
Thanks,
Sachin Kashyap