How do I stop Power BI from repeating the unique ID in a table? - powerbi-desktop

I am pulling data (which I have no control over) into Power BI via direct query. I know that this data has repeating values in several columns, but my unique ID is the project that one or more people are working on together. My table visualization has columns for ProjectID, KeyPersonnel, ProjectStatus, and ProjectTitle. I want to organize the table by ID and list all personnel in the second column. Unfortunately, my table is instead repeating the ID with a row for each person on the project.
For example:
ProjectID
KeyPersonnel
ProjectStatus
ProjectTitle
190884
Smith, John
Complete
"Random Title"
190884
Doe, Jane
Complete
"Random Title"
190892
Bush, Kate
In Progress
"Other Title"
I want it to look like this:
ProjectID
KeyPersonnel
190884
Smith, John; Doe, Jane
190892
Bush, Kate
I have tried switching to a matrix, with ProjectID under rows and everything else under values, but that just forced my users to click on the + symbol to view more than the first person named and it still showed repeating rows.

Related

How can I compare the properties of a vertice, to the properties of another vertice

I'm using Gremlin to interact with a Graph in CosmosDB.
I have some data about employees, data they have access to and departments where both originate from. See below for an example.
I want to retrieve information from my graph about which employees have access to data, but doesn't belong in their department. Basically, I want to see where the department columns are not equal, but the column data_access and data_id are equal, for every database the employee has access to. From the example below I would return information employee_id 1 and 2.
employee_id
name
department
data_access
1
john
A
4
2
rick
B
5
3
nick
A
5
dataset_id
name
department
4
apples
B
5
oranges
A
So far I tried to construct queries using traversal steps like "has", "as", "where" but I couldn't achieve the result I want. I'm very new to Gremlin, so I have no idea if what I'm doing is even the right way to do it.

How to list my Sales Reps for a customer on one line?

I have some orders on NetSuite that has 2 or more sales reps getting commission for the sale. I want to create a search (if possible) that would return only one line with all sales reps' names separated by a comma (John Smith, Jane Doe, etc.) instead of returning 2 (or more) separate lines for the same order but different sales rep name under the Sales Rep column.
You can use the undocumented NS_CONCAT() function in your saved search. If you're using sales teams and your sales reps are returned in the Sales Team Member field, you would combine them like this:
Group your search results by Sales Order (and any other field you need in the results).
Add a Formula(text) field to the results, set the summary type to 'Minimum' and set the formula to NS_CONCAT({salesteammember})
This will combine all of your sales reps into a single field separated by a comma.

How to split name data in the same column in PostgreSQL?

I am new to PostgreSQL and am using PGADMIN 4 on a Mac. I have one column of imported data that has some usernames, sometimes a last name and mostly a first and last name in the same column.
I care more to be able to query and count the most occurrences of a name in the column. I will be able to determine by results if it is a first or last for my need. Listing the first 50 should do it. Please assist with the specific code including addressing the table and column.
Have played with this, but need more:
select surname, count(*) from atreedata
group by surname
order by count(*) desc limit 40;
Works great with only one name! I need the most common names listed by name and count.
Common Column Example:
John Smith
jsmith3
Stacey123
Bob Smith
Jones
So, if I understand it correctly, you just need to find the most numerous words in surname column.
There's a built-in function regexp_split_to_table that can split strings to words and creates rows from those words. So:
select surname_word, count(*) as surname_word_count
from (
select regexp_split_to_table(surname, E'\\s+') as surname_word
from atreedata
) as surname_words
group by surname_word
order by surname_word_count desc
limit 40;

Rows missing from linked Access query

Using Excel 2007, I linked to an Access query using the Data>From Access button, and set it to display as a table. All of the rows are present except any with the Type of 'Placement fee'.
E.g. in the example below, the Free Case Fill deductions show up in the Excel sheet, but the Placement fee deduction doesn't. This query exports fine from Access as Excel format, so it seems to be Excel that is ignoring these rows when linking to it.
Any ideas what can cause rows to be ignored when linking to an Access query?
Chain Account Distributor Warehouse StoreID USDate Type of Deduction TotalValue
Bob's Shops Bob's Shops SMITHS Romeoville KH00463 5/1/2012 Free Case Fill 29.8
Bob's Shops Bob's Shops SMITHS Romeoville KH00463 5/1/2012 Placement fee 2.98
Bob's Shops Bob's Shops JONES Greenwood UN20521 6/1/2011 Free Case Fill 38.81
-edit-
The SQL is below - there are about four or five stacked queries until it gets down to table level.
The placement fees are calculated separately and then added into the rest of the deductions straight from the deductions table, so the only thing I can think of is that they are formatted slightly differently and Excel is ignoring them maybe because the values aren't the same numeric type as the other deductions? But when I export the query directly from Access, everything looks like the same type (i.e. all the values are right-aligned as they are treated as numbers).
SELECT Chain, Account, Distributor, Warehouse, StoreID, USDate, [Type of Deduction], SUM([Total Value($)]) AS TotalValue
FROM (SELECT Chain, Account, Distributor, Warehouse, StoreID, USDate, [Type of Deduction], [Total Value($)]
FROM DeductionsStoresGroupedByMonth
UNION ALL SELECT [Chain/Account/Warehouse], [Chain/Account/Warehouse2], Distributor, [Chain/Account/Warehouse3], StoreID, USDate, [Type of Deduction], [Amount($)]
FROM DeductionsByChainNoStoreID) AS [%$###_Alias]
GROUP BY Chain, Account, Distributor, Warehouse, StoreID, USDate, [Type of Deduction];
-edit 2-
This query (and three others like it) just shows two empty rows when linked as a table from Excel - it is just one column of string, and one column of integers, so no idea what the problem is with this one:
SELECT Deductions.[Distributor's Reference], Count(Deductions.StoreID) AS NumFreeCaseFills
FROM Deductions
WHERE (((Deductions.[Type of Deduction]) Like "*free case fill*") AND ((Deductions.Details) Not Like "*placement fee*"))
GROUP BY Deductions.[Distributor's Reference];
Try ANSI-92 Query mode wild card characters for the Like patterns.
WHERE
Deductions.[Type of Deduction] Like "%free case fill%"
AND Deductions.Details Not Like "%placement fee%"

How to change a attribute to a measure with DAX?

I have a lot of data in my database and I wish to display it as a Pivot Table using Power Pivot, however, some of my data is text (some flags, month names, names, last names, etc). Is there a way that I could convert these attributes to measure so the overall peformance of my Pivot table doesn't get affected?
I have some ideas but nothing clear yet, here is a sample of my table
UserID | Name | LName | City | State | QtySold
1111 Jon Smith 2 6 459394
1112 Alex Cash 6 2 31232
1113 Rob Adams 5 1 12434
I only need to use these attributes when I'm looking the data at UserID level (if I see the data at City, State leven It won't mather since I don't care about names / last names) is there a way I could evaluate the context and make the Name a measure?
Something like
=IF(UserID, DisplayLastName, BLANK())
(A new measure that checks if I'm using UserID, If I'm then display the LastName, If not, display blank)
Any ideas?
Thanks,
Oh well it seems that I found what I was looking for
LName:=IF(ISFILTERED(Details[UserID]),VALUES(Details[LName]),BLANK())
As long as UserID is on the Pivot Table, the LName measure will work.

Resources