Power Bi dealing with repeated instruments from REDCap - powerbi

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

Related

In Power BI Desktop, how can I group all measures together (instead of placing under different tables)?

Tableau automatically groups measures together but Power BI Desktop doesn't natively support this. I find it annoying to have to place measures under imported tables as the measures don't really belong to those "parent tables" (and quite often take input from multiple tables — which one would you consider the "parent"?)
So I experimented with some workarounds and I'm sharing the successful (as of the date of this post) ones here:
Method 1 (recommended): "Model" view > "Enter data" to enter a manual data table. Give a name like "_Measures_" so it appears on top of tables, and keep only the default dummy column "Column". Create/move measures under it, then right click to delete that "Column". Now you're left with a blank table that groups those measures under it.
Method 2: "Data" view > "New table" to create a DAX calculated table. Rest the same as above, except that for a DAX calculated table you can't delete the dummy column but instead you can hide it.
You can also "Enter data" using Power Query Editor but I don't recommend going with that extra step -- workarounds are supposed to be quick (and dirty) anyways!
Final results look like this (note the difference of the icons):

Is there a way that POWERBI does not agregate all numeric data?

so, I got 3 xlsx full of data already treated, so I pretty much just got to display the data using the graphs. The problem seems to be, that Powerbi aggregates all numeric data (using: count, sum, etc.) In their community they suggest to create new measures, the thing is, in that case I HAVE TO CREATE A LOT OF MEASURES...Also, I tried to convert the data to text and even so, Powerbi counts it!!!
any help, pls?
There are several ways to tackle this:
When you pull a field into the field well for a visualisation, you can click the drop down in the field well and select "Don't summarize"
in the data model, select the column and on the ribbon select "don't summarize" as the summarization option in the Properties group.
The screenshot shows the field well option on the left and the data model options on the right, one for a numeric and one for a text field.
And, yes, you never want to use the implicit measures, i.e. the automatic calculations that Power BI creates. If you want to keep on top of what is being calculated, create your own measures, and yes, there will be many.
Edit: If by "aggregating" you are referring to the fact that text values will be grouped in a table (you don't see any duplicates), then you need to add a column with unique values to the table so all the duplicates of the text values show up. This can be done in the data source by adding an Index column, then using that Index column in the table and setting it to a very narrow with to make it invisible.

How To Pivot Table Visualizer in Power BI

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:

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

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:

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