Power BI method to Slice string based on "contains text" - powerbi

I have a string of concatenated data separated by a delimiter "; ". For example: Dog; Cat; Mouse;. (the components of the string can appear in any order leading to a large amount of possibilities)
I am trying to figure out if a custom visual or a method to query the data exists so that if I'm interested in all records that contain "Dog" I can visualize just those....
My first idea was to split the concatenated column in Query editor into 3 separate columns. Then, create a relationship between a table of distinct animals and each of the 3 columns. However, only one active relationship can exists between the distinct animals and the split columns so that's where I stopped.
If this were an excel dashboard I'd just build a VBA drop down box that sliced my data.... so I'm hoping a similar visual slicer exists somewhere....

Back in the Query Editor, after your Split, I would select all the other columns and from the Transform ribbon choose Unpivot Other Columns. This will give you 3 rows for each input row, with each animal name on a separate row.
After renaming the generated Attribute and Value columns, you can create the relationship.

Create a calc column with the FIND function.

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

PowerBI - Duplicate Entries in Query

I have created a query on three tables. Here there is a column GUID (which is actually unique), then there is a column date/time and a column with a phone number.
Now if the same phone number calls more than once, get duplicates with always the same GUID. Can I filter this in Power BI so that the ID only appears once?
If I understand your requirement correct, There is an option in Power Query Editor to remove all duplicate rows. You can first select your all 3 columns- guid, date_time and phone_number. Now right click on any of the Column's header and select Remove Duplicate from the list as shown in the below sample image-
This should keep only 1 rows per distinct combination considering 3 columns.

Multiple Search in power bi

I have a table with columns Firstname,middlename and lastname , implemented custom 'text filter' to search. How canĀ  I implement multiple search that allows user to enter a word and it should fetch among all the rows with that word matching at least one of the 3 columns.
I tried to implement by creating a new table ,check measure and measure , by union of all the columns.And this procedure is taking more space as a new table is created for it.
Is there any other way to do multiple search other than the above mentioned one so it does not increase the size of the file.

count and search combined in Power BI

I have a table and each row is a different class. One of the columns has student names separated by commas. I want to make another table that shows the number of classes that the student is in. Basically, what I need is a DAX formula to combine search and countrows. The first table is what I am starting with. The second table is what I want but cannot figure out an easy way to do it.
I can only think of creating a separate table for each student and then use union to put them all together.
table 1 is what I have
Table 2 is what I want in the end
It is not possible like you want to do it, you need to redesign your first table. This datarow
Class Students
Physics A, B
has to look like this:
Class Students
Physics A
Physics B
You can do this in the under edit querys. Select the column Students and click on Transform > Split Column > By Delimiter. Chose Comma as delimiter and go to the advanced option and check the Rows option. If you hit OK you get the table like you need it to evaluate your data.

Comparing 2 Tables in PowerBI

Working on a way to compare 2 tables in PowerBI.
I'm joining the 2 tables using the primary key and making custom columns that compare if the old and new are equal.
This doesn't seem like the most efficient way of doing things, and I can't even color code the matrix because some values aren't integers.
Any suggestions?
I did a big project like this last year, comparing two versions of a data warehouse (SQL database).
I tackled most of it in the Query Editor (actually using Power Query for Excel, but that's the same as PBI's Query Editor).
My key technique was to first create a Query for each table, and use Unpivot Other Columns on everything apart from the Primary Key columns. This transforms it into rows of Attribute, Value. You can filter Attribute to just the columns you want to compare.
Then in a new Query you can Merge & Expand the "old" and "new" Queries, joining on on the Primary Key columns + the Attribute column. Then add Filter or Add Column steps to get to your final output.