I am designing a PowerBI report using DirectQuery on a database.
In the database I have tables for persons, languages, and a link table telling which language a person speaks.
Example:
Persons
-------
Anna
Jane
John
Luis
Languages
---------
English
French
Spanish
Persons_Languages
-----------------
Anna English
Anna French
Jane English
Jane French
Luis English
Luis French
Luis Spanish
I would like a report in PowerBI of the most common languages combinations. For example, in this case both Anna and Jane speak English+French, while Luis speaks English+French+Spanish. The desired report would show:
English+French 2
English+French+Spanish 1
Since I am trying to learn PowerBI, I need to exclude any solution at the database level.
Yes, Alexis Olson is right, working with direct link, can't allow you to build measures/calcolated tables on data.
You have here 2 choices:
1- change from direct link to import and then build your ad hoc measure/table
2- directly build your measure on the source database, and then access the table from PBI
Good luck ;)
Related
I have a dashboard that looks like this in PowerBi:
Almost every slicer and visual on this page comes from the "visits" dataset. That dataset is 70,000+ rows, where each row stands for a single patient visit to the hospital. There are a few relevant columns for this question such as: "subject mrn", and "protocol_no" (the study they're on).
Well, elsewhere, I have a dataset called "Data Managers" that is the staff assigned to each protocol. It has relevant columns of "subject mrn", "protocol no" and "staff name"
I have these datasets in my power bi like this:
When I connect these datasets by dragging in between them, Power BI warns me that they are many-to-many relationships. This makes sense because:
Lets say staff member John is the data manager for patient 12345 on study x
Well patient 12345 might also be on study y, and on that study, staff member steve is the data manager.
Also, other patients on study x might have other data managers.
So I need to connect these datasets in a way that when I filter to John, I only get rows back from the visits data where John is the data manager for that combination of subject AND study.
When I just drag across from protocol no and subject mrn like this
it doesnt work. The dropdown appears to filter to lists for john, but when I check for accuracy, its people with totally different data managers. Any idea what to do?
If anybody is looking at this, theres probably a way to do it with managing multiple relationships, but I ended up creating a concatenated column in each dataset of "Protocol, subject_mrn" and then linking those new columns together.
I have a multidimensional cube visualized in Power BI
Imagine a fact table which has a total sales amount which is filtered using slicers. Problem is when you choose some slicer's options the chart's value showing sales amount by country falls to zero.
In other words I have some junky choices in my slicer which i want to throw away and clean them. Any ideas how to do it ?
(To add some imagery to my comment)
Make sure you have used the latest version of Power BI as some versions ago (I believe it was May) they introduced filtering of your slicer visual. See the image for an example.
Cleaning up slicers is very useful and pretty easy to do, thankfully.
To give you an example of how, and why you may do this, follow this hastily put together example.;
You have a client, Fruit Land USA that sells fruit on a grand scale. They send you data about the fruits that they sell, you clean it up and sent it back as reports.
Jackson Appleman from Fruit Land USA emails you and tells you that the reports you send out are fine, but he has a special love for Apples, for some mysterious unknown reason that isn't evident by his name.
What do?
You can throw down a slicer onto the report as you normally would, but now you see apples, oranges, pears, peaches, and bananas in your slicer. You don't want this.
So what you can do is click your slicer and drag your fruit column into the "visual filters" pane on the right, and deselect everything except for apples. Congrats, Jackson will now only be able to see data related to apples for this slicer.
But oh no, Jackson Appleman has navigated to page two. He sees data for bananas, pears, peaches, apples, and oranges. He nearly vomits at the sight of these non-appley fruits.
What do?
You can forgo the slicer filter, and follow that same path, except keep scrolling down and drag that fruit column into the "report level filters" and deselect everything except for Jackson's succulent apples.
But now John has a craving for that yellow apple data. He's tired of seeing the plain, old, cliche red apples, and the bitter green apples.
What do?
You can click the tab that says 'Basic Filtering' on your fruit column inside of the filter (whether it be on the slicer or report) and change that over to advanced filtering. Depending on your data, you can choose 'is not' and hide those boring apples. Bam, Jackson Appleman, who is becoming a real jerk at this point, no longer sees the apples he isn't specifically looking for.
I could go on and on about Jackson Appleman and his tedious requests, but I think you get the point. I hope this helped you. Otherwise, I hope learning about Jackson Appleman was good enough.
I'm new to Power BI and trying to create a slicer for Classes by Instructor. The best value to display to the user is the name, since that is how users normally identify the instructors. The problem is that some instructors have had name changes. This actually leads to two problems:
1. How to roll the duplicates up into one item in the slicer selection options, and
2. How to use the combined underlying DimIDs for actually slicing the data.
Sample source table structure looks like this:
InstructorDimID InstructorID InstructorName
--------------- ------------ --------------
1 1 John Smith
2 2 Karen Jones
3 2 Karen Watson
4 3 Jennifer Anderson
5 3 Jennifer Hancock
Would like the slicer to look like this:
Jennifer Hancock
John Smith
Karen Watson
I have an idea of how I would do this in SQL but don't know if it's at all relevant for Power BI. I tried searching stackoverflow as well as Power BI sites with no luck; am looking for an approach that will help me learn how to "think in Power BI". Any tips are much appreciated.
This has to be a part of your data model.
Either add a new table keyed by InstructorID that has the current name of each Instructor, and a relationship with filter flow to your existing InstructorDim, or add a CurrentName column to your existing InstructorDim.
In the GeoLite2 Country database does anyone know if a list of the two character country/organisation codes can be found anywhere or what source its using?
The GeoLite2 and GeoIP2 databases use GeoNames as a data source. See their list of countries. Generally, the country codes follow ISO 3166-1.
I am new to SQL and need to query a database to extract certain information before I can import it into another software I am familiar with to analyse the data. The table I am trying to query has information that looks like below:
MV: Gone Girl (2014)
BT: USD 61,000,000
CP: Twentieth Century Fox Film Corporation, Regency Entertainment (USA), Inc.
GR: USD 167,735,396 (USA) (8 February 2015)
GR: USD 167,590,676 (USA) (25 January 2015)
GR: USD 37,513,109 (USA) (5 October 2014)
GR: USD 167,761,501 (USA)
I would like to extract the information in the lines that start with GR, and I would like to organize them into four columns;
currency,
amount,
country,
date.
After spending a lot of time I have now put together the following code (I know it is not an elegant way of doing it), but it does not grab the information in the last line because it is missing the date information. I would like the date column to be empty for the last row, but still extract all the other information.
regex_match '(?:GR:[ ]([A-Z]{3})[ ](\d{1,3}(?:[,]\d{3})+)[ ][(](USA)[)][ ][(](?:|\d{1,2}[ ]\w+[ ]\d{1,4})){1}','g')
I would be grateful if someone could help me to fix my code.
This might do what you want even if I'm not sure it's what you need it's at least what you asked :
(?:GR: )([A-Z]{3}) ((?:[0-9]{1,3},*)*) (?:\(([A-Z]{3})\)) *(?:\(([1-9]{1,2} [a-zA-Z]* [0-9]{4})\))*
You can check here to see the result.
You have 4 groups one for each of your column. And sometimes the fourth can be empty (if there is no date for example).