Google Data Studio Scoreboard SUM calculation - google-data-studio

I have my data on Excel and I uploaded in Google Sheets so I can use Google Data Studio, everything in Data Studio so far working good, but I am having trouble in a case.
Few of my fields in Data source have values in numbers from 1 to 1000+ and I chose cell formatting in excel as Numbers with 1000 Separator(,).
In Data Studio data source I changed same field with "Number" but when I try to create a simple Scoreboard on Data Studio, it seems like it's only doing SUM with values lower than 1000, meaning any value with 1000 or above are being skipped.
I can feel this is because of separator(,) which is troubling and I can use:
CAST(REGEXP_REPLACE)
but I want to know that why it's making trouble, even after choosing correct Cell Format?
Sample Data Link: https://datastudio.google.com/reporting/abafc2cb-9033-4851-9f72-02896a91384c

The field ITEM SUPPLIED is a text field and contains numbers formated as text. However, there is a 1000 separator (,) in the text.
Therefore, every , in the field has to be removed. This can be done by the REPLACE function. Then the CAST converts the text to a number.
CAST(REPLACE(ITEM SUPPLIED, ",", "") AS number )

Related

How to return an array matching a certain criteria in Excel?

I'm trying to parse an XML file in Excel, which is a Japanese dictionary. It contains several translations of each entry into different languages, and some entries have multiple translations per language. I want to write a formula that finds all of the translations by their language code, returns them as an array, and concatenates them using a TEXTJOIN formula. But I don't know how to go about this in Excel.
In Google Sheets, this would be easily solved by a FILTER function, but I can't use Sheets as there's too much data, and I haven't managed to get access to the beta FILTER function yet.
In the below picture, I'm trying to return the values in the <gloss xml:lang*> column, by searching for the values in the lang column. So for example, I want to return all values which have a "dut" next to them, and concatenate those into a single line using TEXTJOIN.
Any idea how I could go about doing this?
I fixed this by downloading the FILTER function. This is part of the Office Insider program, which releases Beta features if you choose to participate. You can access the Insider program by going to File > Account > Office Insider. Then to update your Office version go to File > Account > Office Updates to install the Insider update.
To filter the list by the "lang" column the formula looked like:
=FILTER([range in H column], [range in I column]=T$2)
I haven't specified either range because I used a formula-defined range using the INDIRECT function to avoid filtering through a million rows. The H range is what I want in the results of the filter, the I range is what I want to filter by - the "lang" code. T$2 represents the "lang" code, in this case "dut", and when I copy it across it will filter by each of the 8 lang codes in Row 2.
Then I used TEXTJOIN to combine it the array result into one column using the comma separator:
=TEXTJOIN(", ", TRUE, FILTER(...))

Paste values not working in workbook - Numbers pasted as text need to be converted to numbers

I copied a downloaded spreadsheet that has a bunch of data in it, numbers and text mixed. I've done this before but I'm not sure how I did it since it seems I can't recreate it.
So I copied and pasted the data into my workbook. I pasted values and everything with a number has an error flag saying that the number is stored as text. Somehow I was able to do it before where it just pasted the values with formatting as General and everything did not have an error flag.
Can someone please help me on this?
Unfortunately it depends on how the data is originally stored. If it was stored as text, then you'll get text no matter how you paste it. You'll need to convert the text to numbers.
There are a couple of ways of doing this:
If your spreadsheet has a couple of columns, you can use Text-to-Columns:
Select 1 column at a time
Click Data > Text to Columns
Click Next and untick all Delimiters
Click Finish
Repeat for each column
If your spreadsheet has lots of columns, it's quicker to use a Paste-Special trick:
In an unused cell, enter a value of 1
Copy it
Select all of the data you downloaded
Right click on the data and choose Paste Special
In the Operation section, choose multiply
Click OK
Excel then tries to multiple everything by one. Anything that looks like a number get converted to a number so it can be multiplied by 1, which then doesn't change the number any further.
Note: If you have blank cells, they'll be converted to zeroes. If this is a problem, then use the following steps instead:
In an unused cell, enter a value of 1
Copy it
Select all of the data you downloaded
Click Ctrl-G
Click Speical
Select Constants then click OK. You should now have only cells with data selected.
Right click one of the selected cells and choose Paste Special
In the Operation section, choose multiply
Click OK

Copy data from SQL Server to Excel "NULL" instead of blank NUMBERS

I copy data from a SQL Server result set and paste it into an Excel spreadsheet. The NULL values need to appear as blanks in Excel, but the default behavior is to show the word, "NULL". For text fields, I can apply ISNULL([field],'') in the original query. But what about numeric fields? I don't want it to be 0, it needs to be blank. Is there a query based solution? I keep forgetting to do find and replace.
This is more of a comment but do to low rep, i'll post as an answer. Excel will not show a blank by default for a number value when pasted into the worksheet. It will interpret (correctly) a blank data point as 0. Since you are willing to find and replace 0s with null values, it seems this is for presentation purposes. If that is the case, I'd suggest conditional formatting. Set when the cell's value = 0 make the text white. if you are applying any mathematics to this column, the effect of a null cell or a 0 cell are the same, thus no impact to formulas/functions.

SSRS Format Numeric not summarizing in excel

I need to set a format for a column when the column "KPI" has a value with '%' I need that the value has the format for a percentage otherwise the currency format, so I have something like this:
=IIF(InStr(Fields!KPI.Value,"%")>0,Format(Fields!DIA.Value, "P"),Format(Fields!DIA.Value, "C"))
That expression works properly, but when I try to export that report to excel, that column is not summarizing when I select several columns as you will see in this picture:
As you can see excel is recounting but not summarizing, I have tried formatting each field from SQL Server and with this formula:
=IIF(InStr(Fields!KPI.Value,"%")>0,Format(Fields!DIA.Value, "###.#%"),Format(Fields!DIA.Value, "###,###,###,###.##"))
But the same happend when I export that report to excel, is there another way to handle this?
In order to make sure that Excel interprets a value as numeric, you can use the RenderFormat global variable to detect when the report is being rendered for Excel and not include the problematic formatting characters:
=IIF(InStr(Fields!KPI.Value,"%")>0,Format(Fields!DIA.Value, "###.#%"),IIF(OR(Globals!RenderFormat.Name="EXCELOPENXML",Gl‌​obals!RenderFormat.N‌​ame="EXCEL"),Fields!‌​DIA.Value,Format(Fie‌​lds!DIA.Value, "###,###,###,###.##")))
If its critical that you display a thousands separator in your generated output you can use the Language global variable to detect the user's region and use the appropriate character. That check would take the general form Globals.Lanuage="en-US", depending on what particular regions are involved.
Here's an example of using the RenderFormat.Name variable to check the renderer in VS2013:
When doing a preview of the report, the format will show that the render type is RPL:

SQL Server - Text column contains number between

Can someone tell me how I code in SQL Server so that I am looking in a varchar text column to see if it contains a numerical range within the text?
For example, I'm looking for columns that contain anything between 100000 and 999999. The column may have a value like
this field contains a number `567391`
so I want to select that one, but not if it had
this field contains a number `5391`
For your given example, you can check the digits:
where col like '%[^0-9][1-9][0-9][0-9][0-9][0-9][0-9][^0-9]%'
This is not a generic solution, but it works for your example. In general, parsing strings in SQL Server is difficult. It is better to extract the values you are interested in when loading the data, so the relevant values are correctly in their own columns.

Resources