Create an index column in Power BI - powerbi

I want to create a index column in Power BI but that column must have a string and a number. For example: c1,c2,c3... and not just 1,2,3...
Does anyone know how to solve this problem?
Thank you

Add the index column in Power Query, then choose Add Column From Examples, and enter a few values for the new column. Power Query will figure out the calculated column formula for you. You can then remove the initial index column and rename the new index column.

Related

Replace values in cell with DAX coding in Power bi

I have my data(file name - Data) which I have imported in power bi with a column named values
values
ext
int
safety_int
outside_training
gap_fill_int
so it is a large data, and it contains more than 2k categories , what I want is, to create a new column in power bi where blanks should be replaced with target_emp, and all other values(ext,int,gap_filling_int etc.) should be replaced with non_target_emp.
Please help me to do that in power bi.
In powerbi transform ->
Add Column:
if Text.Trim([category]) = "" then "target_emp" else "non_target_emp"
You could add a conditional column in the data model (sorry that I dont have an English screenshot for this):
Add column
Select conditional column
Add criteria to selection
#1 DAX
calculatedColumn= SWITCH(TRUE(), Data[Column1]=BLANK(),"target_emp", "non_target_emp")
#2 using PBI's binning
go to report view->click on the table->column name-> New Group

How do I create a total_sales column in power bi when I have price_per_unit and quantity_ordered

This has got to be the simplest question ever, but after seeing a half a dozen sites I can't figure it out. How do I create a total_sales column in Power BI when I have a price_per_unit column and a quantity_order column?
All I want to do is make a column that says "price_per_unit * quantity_ordered" but all I get are errors about the column not existing, or the SUM calculation wanting a measure, or some such thing.
Thanks
Create a calculated column (not a measure) on the table those two columns are part of and definite is like
Total_Sales = Table1[price_per_unit] * Table1[quantity_ordered]

Calculated column in Power BI based on relationship between 2 tables

Hi,
I'm trying to add a calculated column in my MergedTable table that will multiply the Time column by the sum of the indicator in the TeamLeave when the week ending dates and the name dates are the same but I'm not sure how or what functions to use(I've tried a number at this stage).
Could anyone provide me with assistance on this?
Thanks,
This:
'MergedTable'[Time] * CALCULATE(SUM('Team Leave'[Indicator]))
The CALCULATE is necessary to perform a context transition (turning the "current row" of 'MergedTable' into a filter that will propagate to the 'Team Leave' table).

How to sum a column filtered by a categorical column in the same table in Power Bi?

I'm trying to get a sum of my sales figures by the product category from the a column in the same table
The original data is on the attached image.
Original Data
And what I'm trying to get is attached also and I am having trouble getting the right numbers for the last three columns
Result
I have tried the following code:
Boots_Sales = CALCULATE( SUM(Sheet1[Sales]), FILTER(Sheet1,Sheet1[Product_Type]="Boots"))
I have found a solution to the above by making a measure instead of a column with the below formula:
boot1 = CALCULATE(SUM(original[Sales]),FILTER(original,original[Product type ]="Boots"))
This will have to do, I was trying to make a column because I wanted to do further calculations on the column but will just have to convert the measure into a column
Thanks

Adding a Total Column to a Matrix-Visual that only sums spcific columns

I have a table that has (simplified) the columns CustID, Action, Date
I then have a matrix visual that has Action as Columns, CustID AS Rows and Count(Action) as Values.
Now I need an extra column that sums only some of the Columns, not all like the Total. In Excel this is =SUMME(B11:K11), where K12 and K13 are the columns not to be summed.
Is this possible in PBI Matrix?
You can simply create a measure.
(new_measure_name) = 'table'[field to add] + 'table'[field to add]
After you create the measure you can add it to the matrix and double check you math that it adds up like you want.
Good luck!
my problem was, that I had a table column in the column section of the matrx visual. than, when I add a measure it is only available in drill, not as extra column. I solved it with pivoting that column and use the new columns in data section. than I can add measures to the data section and they get also new columns.
would be nice, if I could use the column section and add measures