icCube - How to create Excel compatible thousands formatting? - iccube

I have an icCube report where I want "1500000" to be formatted as "1,500K".
If I set FORMAT_STRING="#,##0\K,", the formatting works in icCube but not in the exported Excel sheet. If I set FORMAT_STRING="#,##0,\K", the formatting works in the exported Excel sheet but not in icCube.
How can I specify a FORMAT_STRING that works for both Excel and icCube?
I'm using icCube version 7.10.
Steps to Reproduce Formatting Mismatch
Run the following query from the icCube MDX debugger:
WITH
CALCULATED MEMBER [WorksInIcCube] AS 1500000, FORMAT_STRING="#,##0\K,"
CALCULATED MEMBER [WorksInExcel] AS 1500000, FORMAT_STRING="#,##0,\K"
SELECT {[WorksInIcCube],[WorksInExcel]} ON 0
FROM [MyCube]
CELL PROPERTIES STYLE, CLASSNAME, VALUE, FORMATTED_VALUE, FORMAT_STRING
This will create an icCube table where WorksInIcCube is formatted as 1,500K and WorksInExcel is formatted as 1500000.
Click the "Export the MDX result to Excel" button and open the exported file in Excel. In Excel, WorksInIcCube is formatted as 1,500,00K, and WorksInExcel is formatted as 1,500K.

I cannot reproduce the behavior FORMAT_STRING="#,##0,\K" (assuming you're seeing 1500K in Excel) in Excel.
How are you exporting your MDX result? From the MDX IDE or from the Reporting (which widget?)?

Related

Open CSV data in tableau

I have had problems uploading the following file to Tableau:
https://www.kaggle.com/datasets/shivamb/netflix-shows/download
When loaded it looks like this
but loading it in R
Is it possible to load them in R and then by Rserve connect to tableau or is there a way to load them fine
Looks like a problem within the interpreter.
I can't download the file myself as I don't have a Kaggle account, and its not clear from you R screenshots, though you could adjust the text file properties to see if you can adjust how the interpreter works by right-mouse the object "netflix_titles.csv" in the data model window and selecting Text file properties from the context menu.
Another option would be to try to use the interpreter Usar el intérprete de datos
It looks like Tableau is reading this file as a Text file and not a CSV. Tableau should have multiple headers for every comma that it sees but your screenshot has a single column for the entire first row.
Sometimes, Tableau can correctly read the file if you check the "Use Data Interpreter" checkbox.
If you have trouble making that work, just simply open the CSV in Excel and save it as an XLSX. You could even connect to it via an import to Google Sheets if you don't have Excel.

Saving Excel Table to OneDrive with R PowerQuery

I have a report that all it does is export it's data to excel via power automate using some R code.
"write_xlsx(dataset,"file_path.xlsx")"
However, I need to manipulate it further and it needs to be in a tabular format to do so. Yet, when I try "write.table" I get the error that my connection to OneDrive is not open. So I can export an Excel sheet with the data, but not the same data as a Table.
Any ideas?

Export Crystal Report rpt file to Excel without can grow format object

I am exporting Crystal Report to Excel file using Crystal Report version 13 and VS 2013.
When I tried to export the Crystal Report file to Excel, the columns are merged. I need to unmerge all the fields at runtime so that I can manipulate data in an Excel sheet. TIA
There is a 15-page SAP document describing various aspects of designing Crystal Reports so they export as expected to Excel. Link is here. In your case, the most important guideline is probably to make sure all objects that overlap vertically are perfectly aligned and have the same width.
You may want to consider using Excel (Data Only) export format to get better output. Similarly, you may find that exporting to Tab Separated (TTX) file produces cleaner output when opened in Excel.

How do you convert a table that is in a .docx file to an .xlsx or a csv file in python or R?

I have a document like the one mentioned below. There is some text above the table and then there's a table. How do I extract table from the docx file in R or python and then convert it to a csv file or an xlsx file. I don't even mind a .txt file if it retains the exact format of the table. I just don't know what to do with this doc file.
If the document is docx, then it is all XML. The docx file is just a zip container with various XML "parts". Take a look at the Open XML SDK for some ideas on how to parse the file. This SDK is C#, but maybe you can get some ideas from that.
If you are just going to extract the table it should not be too bad ( Updating complex docx documents can get very complicated. I'm working on this now.) My tip to make things easier is to go to the table properties, then to the Alt Text tab and add a unique value to the "Title" field. The value will show up like this within the table properties: <w:tblCaption w:val="TBL1"/>, which will make the table easier to extract from the XML.
If you are going to work with Open XML documents, get the OOXML Chrome Addin. That is great for exploring the internals of docx files.
Note: I saw the link to another SO answer for this. That uses "automation", which is certainly easier to code, but Office via "automation" on the server is not recommended by MS.
You can extract tables from docx using python-docx in python.
Try this:
from docx import Document
import pandas as pd
document = Document(file_path)
tables = []
for index,table in enumerate(document.tables):
df = [['' for i in range(len(table.columns))] for j in range(len(table.rows))]
for i, row in enumerate(table.rows):
for j, cell in enumerate(row.cells):
df[i][j] = cell.text
pd.DataFrame(df).to_excel("Table# "+str(index)+".xlsx")

How do I prevent data from displaying in scientific format?

I have this sql server query that I am running in my .net app.
(CONVERT(VARCHAR(8), EventDate, 112)+ substring(RequestedBy,1,1)+right( '0000000' + convert( varchar( 7 ), ContactID ), 7 )) as Contacts
It produces the following results in the following format:
20120731e0000001
20120731f0000002
20120731p0000003
This is the result and format that we want.
Problem is when we click on export icon to export these results to excel, the first one changes to the scientific format like 2.01E+08.
Any date that has e in the middle such as 20120731*e*0000001 turns into scientific data.
The rest is just fine.
Any ideas how to fix this?
I want to apologize in advance if I stick the wrong tag in the Tags section since I am not sure where the fix could come from.
The formatting is happening when Excel opens your exported file. Simply change the column to have "formatted text" of string so that it displays as the original format.
When you open the exported data file directly with Excel, all formats are set as General. In General format, Excel applies formatting to what it recognizes as numbers and dates. So, to be clear, the issue is not with your export, but rather with how Excel is reading your data by default. Try the following to get around this issue.
Export to CSV. Then, rather than opening the CSV in Excel, use Excel's 'Get External Data From Text' tool to import the data into an empty workbook. Here you can specify to treat this field as TEXT rather than as GENERAL.
Note that once Excel applies number (or date) format to a cell, the data in the cell has been changed. No application of a new format will bring back your desired data. For this reason you must specify the format before Excel opens the file.

Resources