PowerBi Join column value strings together in each row - powerbi

I have a table like shown below titled Employees:
Name LOC1 LOC2 LOC3 LOC4
-----------------------------------------
Joe DAY CVG DTW
Jane PVD STL
John LAX SAN SFO ANC
I created a measure to combine the LOC fields into 1 result separated by a space. I keep getting errors because PBi wants to aggregate the data fields. All fields are type Text. I've tried all the usual combine methods, below are a couple of examples...
CombineLOCs=CONCATENATE('Employees'[LOC1],'Employees'[LOC2])
CombineLOCs= 'Employees'[LOC1] & " " & 'Employees"[LOC2]
This is what I get back:
"A single value for column 'LOC1' in table 'Employees' cannot be determined. This can happen when a measure formula refers to a column that contains many values without specifying an aggregation....etc."
I ultimately have a table visual on my canvas and instead of listing out all of the columns on that table, I just want 1 column with all of the combined LOC values for each employee in it.

If you just want a single column where the LOC columns are joined together, then you need to create a new column within the table, rather than a new measure. A measure expects you to aggregate the values. A column will concatenate the text strings on a row by row basis.
If you select the new column option, either on the table tools or the fields sidebar, then use the concatenate formula in your question, that should work.
With the new column, you can then include the employee name and the associated LOC values.

Related

Group 10 columns of data to gain distinct count of rows Power BI

I'm trying to display all of the distinct values within this table (there are many other columns in this table) and show how many rows each distinct value shows in.
I have tried to use group by but this does not work. It needs to be filterable by country from another column but i can do that by page filter.
I am trying to show what the top 5 associations are in terms of appearance.
enter image description here
Put the 10 columns in a Table visual. Then create this measure and add it too. Then sort descending on Distinct.
Distinct = COUNTROWS('Your Table Name')
To see only the Top 5, go to the Filter pane, and pick the first column and set the Filter type to Top N, and then Top 5 by the Distinct measure.

Lookup value with multiple scenario in Power Bi

I have a two tables are Data and Report.
Data Table:
In Data table contain two columns are item and supplier code. The item column contain text & number and supplier code column contain as a text.
Summary if CHE record in DATA:
if any of the items have CHE records in the data table, get the values if only one CHE record, and if there is more than one CHE record then compare each column (length and Supplier) and if any of the columns has different value then return MIXED otherwise return Actual value
Summary if no CHE record
if only one none CHE record in the data table then returns the actual values but if more than one none CHE records in the data table for that time, compare the values of each column, and if any column value is different then return MIXED otherwise value.
Summary: no record found in DATA table:
Return N/A
Logic
My first priority is “CHE” and second priority is “KKR” in order get the length and supplier from Data table into the Report Table.
Scenario 1;
If two different supplier {“CHE” & “KKR”} for the same item in data table then I would like to get the data (length and supplier) against “CHE” in report table according to the item. (Please refer the item 123 and 5678 in both tables ”Data” and “Report”)
Scenario 2;
If supplier not repeated according to the item and the item contain either any of these supplier {“CHE” or “KKR”} in data table, in these scenario pull the data (length and supplier) against the item in report table based on the availability in data table. (Please refer the item 5555, 6666, 9876 and 2345 in both tables ”Data” and “Report”)
Scenario 3;
If supplier not repeated according to the item and the item contain either any of these supplier {“CHE” or “KKR”} but the length & supplier are different in data table in these scenario return as a text “Mixed” were belongs to (column; either length or supplier or both) in report table according to the item. (Please refer the item 123456 and 567 in both tables ”Data” and “Report”)
Scenario 4;
If two different supplier {“CHE” & “KKR”} for the same item in data table but the length and supplier are variable in data table in this scenario return as a text “Mixed” were belongs to (column; either length or supplier or both) in report table according to the item. (Please refer the item 116 in both tables ”Data” and “Report”)
Scenario 5;
If records not found in date table the return as “NA” in report table according to the item. (Please refer the items in report in table 4444, 12 and 10)
I am looking for calculated column option in order to achieve my result.
Current logic
I created New table for order for supplier priority
I created two helper column for running count and unique count
Finally I am applying the following calculated column in report table
LENGTH = LOOKUPVALUE(
DATA[Length],
DATA[ITEM],REPORT[ITEM],
DATA[UNIQUE_COUNT],1,"NA")
it almost working fine but it will give a wrong result (item 123456 and 567) were my desired is "Mixed" in report table. I highlighted in red and green snapshot for your reference.
My final result look like this
Herewith attached the PowerBi file for your reference https://www.dropbox.com/s/p81uy12tfh1htwu/AUOM1.pbix?dl=0
Can you please advise.
It's not entirely clear what you're trying to do but I think this measure pattern may help you:
IF (
DISTINCTCOUNT ( DATA[SUPPLIER] ) > 1,
"MIXED",
SELECTEDVALUE ( DATA[SUPPLIER], "NA" )
)
For more than one value, you get MIXED. For one value, you get that single value. For no values, you get NA.

Create table comparing Two Queries with identical fields/field names

I would like to create a table to compare Month To Date (MTD) Vs YTD Sales data metrics
I am using two queries:
1st query = YTD Sales data (Two fields: Sales and Quotes)
2nd query = MTD Sales Data (Two Fields: Sales and Quotes).
Each query has the same field names, just different data
I would like to output a table like the following
How to I create the above table? At the moment I can only create a table like the following:
The latter 1x4 table only works if I appropriately name the fields. But definitely isn’t what I want, because with enough fields, the table could go on forever.
Any help would be appreciated
In the query editor, create a label column for each table that labels what they are and then append the two tables together so you get something like this:
Then you can create a matrix visual with the Label column in the Columns field and the Sales and Quantity columns in the Values area.
Make sure you've switched "Show on Rows" to "On" under the Format > Values section of the Visualizations pane.

Power BI creating table/report from multiple tables

I am new to power bi and trying to create table/report that pulls data from three different tables.
I have one table "Conversion": with columns like: conversion_id, date_converted,channel, revenue and other columns and measures
Second table "Qualification": Qualification_id, date_qualified, channel, revenue and other columns and measures
Third table "Spend" : Date, channel, Spend and other columns and measures
Qualification_id is same as conversion_id but it could have different dates (dates for id that got converted and qualified many times differ) and not every id that converts qualifies.
I want to display sum(spend) , count of qualifications , count of conversion and qualification rate (qualification/conversion) grouped by date and channel in one report
There were no relationships detected in amongst these three tables. Please note that the date values are not unique. I am looking into creating star schema and calculated table but since I am super new to this I am struggling to create this view. Any help would be appreciated!
If I have understood correctly ,conversion_id & date_converted will match Qualification_id & Qualification_date ,if the Conversion_ID qualifies.
If this is the case maybe you can create a new Column in both the tables which will be a concatenation as below and join those two columns like
Qualification_Key = Qualification_id & "-" & Qualification_date
Conversion_Key = Conversion_ID & "-" & date_converted

A table of multiple values was supplied where a single value was expected, when using Distinct

I have the following table:
I'm trying to create a new column using Dax language:
Column = DISTINCT('Edição'[País])
But I gott this error message:
A table of multiple values was supplied where a single value was expected.
The expected result is:
You have a source table with 21 rows. You want to add a column. In the end you'll still have 21 rows.
The "expected" table has 18 rows. So with only adding a column you will never get there, it's just impossible.
To get the expected output though, you can do this easily: just create a table with just Pais as values and PowerBI will automatically group. See here a (more minimal) example:
PS. If you wanted to add a column -say- with the number of years the country appears in the source data, you should:
choose the matrix visualization
add "Pais" (country) for rows
add e.g. "Ano" (year) for values, and summarize by "Count (Distinct)"