Any chance I can replace the negative numbers in a column with zero, in Power Query. I was looking all over the internet, couldn't find an answer...
Thank you.
Right click the column, transform .. absolute value
edit the end of the code from something that looks like this
= Table.TransformColumns(#"PriorStep",{{"Column1", Number.Abs, type number}})
to look like this
= Table.TransformColumns(#"PriorStep",{{"Column1", each if _ < 0 then 0 else _ , type number}})
Related
I'm trying to use RXExtract as a calculated column to dissect [column1] by it's values. [column1] looks like "location- 1234 (abc)" and I'd like to just separate the "1234" out of it.
My current code in Spotfire is RXExtract([SM Code], '(\d)(\d)(\d)(\d)', 1 ) but I get an "invalid escape sequence error". Where am I going wrong?
Thanks!
Try
RXExtract([SM Code], '\b\d{4}\b', 1)
this will match any four consecutive or unconsecutive digits.
Probably a really easy solution.
I'm working with a sheet that has a simple division of two numbers to return the difference as a percentage. In this case: =O12/K12
Now if O12 and K12 are empty the cell returns a value of 0.00%. How can I change the formula so it just stays blank if there is no data in O12 and K12 please?
Any help would be amazing!
Thanks
Ryan
This happens because the empty string in a math formula is parsed to zero.
To avoid this, you could check if both are numbers before:
=IF(AND(ISNUMBER(O12),ISNUMBER(K12)),O12/K12,)
What it means: if O12 and K12 are numbers, calculate the division. If not, return an empty string (blank).
try:
=IFERROR(1/(1/(O12/K12)))
I am trying to extract the tip value from columns in Google Sheets. What would be the proper regex argument to use to do this? Some columns do not have the tip value, and in this case i would like it to return "0".
Tip - 20% x $134.00Damage Waiver: 5% x $40.20Coupon: Thanks for considering us!! x -$10.00Tax: 7.25% of $700.20 x $50.76
If the input string (let's say at A1) has the word "Tip", and the first dollar symbol after that initiates the amount of interest, then do:
=IFNA(VALUE(REGEXEXTRACT(A1, "\bTip\b[^$]*\$([\d.]+)")), 0)
This expression will produce a number type, so the dollar is not included.
Apply the desired number formatting to the cell where you place this formula to show a currency symbol, and the required number of decimals.
I have a column with ID'S this column is dynamic so it will grow up, next to it I have a count formula for the number of text appearing this one:
=COUNTIF(F3:F12,"?*")+COUNT(F3:F12)
I would like to have a formula to count just when exist an ID if not will be "".
Try below formula-
=COUNTA(IFERROR(INDEX($E$3:$K$18,,MATCH(A2,$E$1:$K$1,0))))
This is the formulas I was looking for:
=IF(A4<>"", (D4/$B$2), "")
I have this measure in DAX:
SWITCH ( TRUE () ,
MIN ( 'Dynam'[ID] ) = 5 , DIVIDE ( [Gross] , [Revenue] ) * 100,
MIN ( 'Dynam'[ID] ) = 8 , [Hours]
)
I would like the first one to have one decimal, but not the second one.
Can I do a formatting for one row only?
As of now, I have it like this for the entire measure:
Here are a few options:
Like Jeroen said, you can use FORMAT in your measure but it will be text. If you can't have the measure as text is some places, just have a text measure and a number measure.
Use two measures, one for hours and one for dollars. You can't really chart or SUM things well when sometimes it's hours and sometimes it's dollars, so split them out.
You could always drop the decimals on the dollars and use whole number for both.
If your data for both is always positive, you can play tricks with the positive and negative formats in Power BI (and probably SSAS?) using a custom format string such as 0.00;0;0. In a custom format string, the first format is the positive number, the second is negative, and the last is zero. The trick is to use the positive format for dollars and the negative format for hours. Here, positive numbers are shown with decimals (0.00), negative numbers are shown as whole numbers without a minus sign so that they look like positive numbers (0):