i have data set like
Car Make Model Type Origin Seat MRP Show Room Price Rate Star
Acura|MDX|SUV|Asia|All|$36,945|$33,337|3.5|
Acura|RSX Type S 2dr|Sedan|Asia|Front|$23,820|$21,761|2|
result value assisgn column as per result shown
Expected Result
Car Make Model Type Origin Seat MRP Show Room Price Rate Star
Acura MDX SUV Asia All $36,945 $33,337 3.5
Acura RSX Type S 2dr Sedan Asia Front $23,820 $21,761 2
i want two code one is upload note pad file from desktop
another is assisgn in data set in data lines and input
Related
I am trying to calculate market share, but struggling with doing it correctly.
I have a matrix where I have Category, Name as rows, Channel as column, and Market Share as value.
Also In my dataset I have columns ABS_COMPANY (with sales inputted there if company = "A", so there are some blank ones), and ABS_TOTAL (with sales inputted in each row)
so my measure Market Share:
Market Share = SUM(table\[ABS_COMPANY\]) / SUM(table\[ABS_TOTAL\])
This correctly calculates values for each Category, but when I open the drop-down to see Name, Market Share of each Name equals to 100%. What is the problem and how to fix it?
e.g. What is now:
Market Share
Pens 43%
pen 1 100%
pen 2 100%
pen 3 100%
Pencils 29%
penc 1 100%
penc 2 100%
penc 3 100%
I've tried using Calculate(), but it does not work in a way I want to.
Unfortunately, I cannot share the data as it is sensitive.
Structure of dataset:
NAME STRING
CATEGORY STRING
CHANNEL STRING
ABS_COMPANY DECIMAL(20,2) - value of sales for each name
ABS_TOTAL DECIMAL(20,2) - it is a value grouped by CHANNEL AND CATEGORY at the backend
I have data that has:
a result value
A lat & lng
a date
I have discretized the date to years which works fine. I have used the Geocoding add-on to extract the continent from the lat/lng coords. And now I want to get the average result value of the continent per year. I'm at the point where I have all the values available, but I can't figure out how to group the result (mean)by continent-year categories.
I have set up the following flow.
The table you see above comes from the red square
enter image description here
enter image description here
I want to create a calculated column that can translate several values into something that is more readable.
My example is something like a list of company departments, most are formatted with a formal name in the example below I'd like to calculate a column to convert acctng to Accounting
Sales
Marketing
Manufacturing
Support
acctng
So the calculated column would read
Sales
Marketing
Manufacturing
Support
Accounting
I'd like to create a calculated column that transfers over all items as they are except, when we see accting it's converted to Accounting. I know that I can do a transformation in the data view, however, I'm hoping for a dax formula.
Thanks!
If you want to do that with DAX, then you can create a new column and use SWITCH function:
Department (Translated) =
SWITCH(Sales[Department];
"acctng"; "Accounting";
"smtng"; "Something else";
Sales[Department])
I discovered PowerBI few hours ago and I am trying to render a new graph, pretty complex from my data.
My subject:
I have a list of employees from my society with some information (name, location, seniority, ....) inside a table named Suivis de mission.
I'm focusing on seniority column. I have to display, monthly, the number of employees which has less than 3 seniority years, more than 3, more than 5 and more than 8.
This field is calculed through another field (date_de_changement_de_mission) by the next formula:
(today - date_de_changement_de_mission) / 365
It gives me a number according to the seniority years (above in french)
My experimental work:
I tried to make some things and this is what I have up to now.
I created a new table with months (string column1 and int column2) and the third column according to the number of employee with less than 3 seniority years for each month.
This is the formula that I'm trying to implement in order to get the number but I have lot of mistakes :
Nbr_inf_3_ans = SUMX('Suivis de mission';
IF(
'Suivis de mission'[Activité] = "En poste";1 &&
DIVIDE(
DATEDIFF(01/01/2019;'Suivis de mission'[Date de changement de mission].[Date];DAY);365)
;"null"))
The formula must contains several conditions :
Field 'Suivis de mission'[Activité] has to be : "En poste"
Loop over each month in my table (if the month is not targed, display 0)
I'm a bit lost.
Assuming that:
You want to do it in Power Query Editor
You already created the "seniority" and "month" ("mois*") columns
You are not worried about the year (you are really grouping just by month)
Then these steps may help you to begin:
Create a custom column name "IsLesserThan3" with the formula:
if [Seniority] < 3 and [Activité] = "En poste" than 1 else 0
Change the formula to include the requirement about "if the month is not targed" (i didn't get what it means, sorry).
Choose "Transform" (menu), then "Group By", then basic, set group by = month, give it a name ("Nbr_inf_3_ans"), set operation = sum, set column = IsLesserThan3
EDITED
New extra assumption:
There is a second table with month description and month number and you want to create the new column there ("Nbr_inf_3_ans") and fill it, probably to grant all the months are there (including those with no occurrences).
With this new assumption in mind, the approach will be to join the two tables and do the same thing:
Create a custom column named "IsLesserThan3" with the formula:
if [Seniority] < 3 and [Activité] = "En poste" than 1 else 0
Change the formula to include the requirement about "if the month is not targed" (i didn't get what it means, sorry).
Change the type of the new column to integer (click the icon to the left of the column name).
Create a custom column named "Mois_int" with the formula:
Date.Month([date_de_changement_de_mission])
Then join the tables by month. To do that, select the other table and choose "Transform" (menu), then "Merge", then let the second table selected and select the first table as the "bottom" table, select columns "Mois_int" in both tables, set "join kind" = "left outer".
PowerBI will create a new column wich name is the name of the first table. Click the arrows icon in that column header and choose "aggregate" and mark only "sum of LesserThan3".
I have data in tableau like below
day employee expense_reason expense
2/24/2018 abc car mileage $5
2/24/2018 xyz car mileage $5
2/24/2018 xyz car rent $8
2/24/2018 xyz car rent $9
I want to find occasions when on a same day, single employee claims both expenses. I am producing below view in Tableau using
day and employee as rows
expense reason as column
and sum(number of rows) as Text
i am getting grand total using analysis>>totals>>show row totals
instead of getting row totals, how could i get count of non zero values in a row
expense_reason
day employee car mileage car rent grand total
2/24/2018 abc 1 1
2/24/2018 xyz 1 2 3
update 1
i tried below as per one of the answers but it is not giving output that i want
First of all you should solve the No-Data part since there's no data for the combo abc-rent.
You can achieve this using the lookup function, forcing a fake lookup using 0 as parameter.
Something like this:
LOOKUP(SUM([Something]),0)
Then you can use ZN function to force a zero for a null value, which is different from No Data.
That being said, you should be able to get something like this:
Here's the Calculated field:
zn(LOOKUP(max({ FIXED [day],[employee],[reason] : COUNT([reason])}),0))
EDIT
If you want to have grand totals, i think this should be the better solution:
And the Calculated Field is a pure Count nested in a lookup function as said before:
zn(LOOKUP(COUNT([expense]),0))