Remove Decimals without Rounding Power Q - powerquery

How to remove decimals without rounding in Power query?
Thanks.

Add column, custom column
= Number.IntegerDivide([ColumnNameHere],1)
or transform the column to remove decimals
= Table.TransformColumns(#"PriorStepNameGoesHere",{{"ColumnNameGoesHere", each Number.IntegerDivide(_,1),type number}})
or transform data type of column to whole number

Related

Conditional formatting in matrix cells

I have the following matrix loaded:
I need to change the font color of the BB column values ​​when the value is below the value contained in the MIN column cell.
Being grouped columns, the MIN column will not always be in fourth place. How can I do to compare values ​​taking into account the name of the columns?
Thank you!!
I share the output of the dataset:
I have found a solution based on our discussion in the comments:
Create a calculated field in your dataset Ref = ELEMENT + COMPONENT (concatenate the 2 colums, this will be used later)
In the Row Group properties, add a variable MinVar =lookup("MIN" & Fields!Component.Value ,Fields!Ref.Value,Fields!Value.Value,"DataSet1") (replace DataSet1 with your dataset name)
In the font expression of the value field add an expression =if(Fields!Element.Value ="BB",if(Me.Value< Variables!MinVar.value,"Red","Black") ,"Black")
I have tested this and it is working on my end.

How to convert only one (out of several) numeric columns to one decimal point

I have a dataframe with 3 columns. The column 'machinery' represents word counts, 'cum_sum' is a rolling total count of the column titled 'machinery' and 'cum_pct' is the rolling cumulative percent total.
I have tried pd.options.display.float_format = '{:,.1f}'.format but this shows 1 decimal place for all columns.
How to I show the column 'cum_pct' to one decimal place, not changing the decimal place for the other 2 columns?
Solution:
# Generate rolling total of the column machinery in data frame 'tokens_test' like above:
tokens_test['cum_sum'] = tokens_test['machinery'].cumsum()
tokens_test['cum_pct'] = ((100.0*tokens_test['cum_sum']/tokens_test["machinery"].sum()))
# Apply formatting:
cols = ['cum_pct']
tokens_test[cols] = tokens_test[cols].applymap('{:,.1f}'.format)

Sorting String Numeric Numbers in SSRS Matrix

I have a column in my matrix table that is a varchar containing numeric values (stepName). In the report, it prints off as 1,10,11... 2,20,21,22... etc instead of 1,2.. 10, 20.
I found another question that suggested either converting the varchar values to int and then sorting, or adding a datatype numeric column and using that to sort. (sorting string numeric values in SSRS 2008)
I can't convert the varchar values to int as I have about 50/50 varchar/numeric values. I actually have a numeric sequence column, but when I tried to use this as a sort both in the query, the column tablix properties and the list tablix properties, it still didn't sort. What am I missing? Thank you!
select hrss.salaryScheduleCode, hrss.salaryScheduleName, st.stepName, st.seq, sl.laneName
from dbo.HRSalarySchedule hrss
left join dbo.HRSalaryScheduleStep st on st.hrSalaryScheduleID = hrss.hrSalaryScheduleID
left join dbo.HRSalaryScheduleLane sl on sl.hrSalaryScheduleID = hrss.hrSalaryScheduleID
order by hrss.salaryScheduleCode, st.seq, sl.seq
Change the sorting of the tablix to use an expression:
=CInt(Fields!stepName.Value)
Edit:
Ok, I misunderstood the 50/50 thing with varchar/numeric values, so here's a better solution.
The Val function evaluates a leading numerical value, so I suggest to create 2 sorting columns:
Expression =Val(Fields!stepName.Value)
Field stepName
This will for example create a sort order like this:
Here's a screenshot to clarify what to configure:

PowerPivot DAX Max of two values

I have two columns and I need to extract the maximum value of those two for every row in my table. I have looked at the Max, Maxx and Maxa, but they all have input for just one column.
How would I write following expression in a Calculated column:
=max(
Table1[Column1],
Table1[Column2]
)
Actually, you should write the formula exactly as you described:
=max(
Table1[Column1],
Table1[Column2]
)
MAX function in dax exists in 2 versions: one takes a single column, the other takes 2 singular expressions.
Instead of MAX, you can just use a simple IF to achieve what you want:
= IF(Table1[Column1] >= Table1[Column2], Table1[Column1], Table1[Column2])

SSRS Matrix hide last column

I want to hide the last column for matrix in SSRS.
The column is in number format.
I have try the column visibility with expression like
IIF(Fields!abc.Value = Last(Fields!abc.Value), true, false)
but it didnt work. It still show all columns.
Is it my last function use incorrectly?
Any other way to do this ?

Resources