.NET Winform - Pivot Table for multiple Data Value columns - vb.net

I need to create a pivot table at the front end after retrieving data from the DB in a datatable and need to update the values of my grid with this data.
I have gone through many articles/blogs but they all demonstrate it by using one Data Value column. But in my scenario, I have 8 Data value columns to be pivoted.
Data To Pivot
Pivoted Data
Do someone has idea how to do it efficiently at the front end?
Would it be a good idea to embed the data in excel, create the Pivot there and retrieve the required data from excel?

Related

Column with multiple data types in Power BI Matrix Table

My issue is similar to this one Multiple data types in a Power BI matrix but I've got a bit of a different setup that's throwing everything off.
What I'm trying to do is create a matrix table with several metrics that are categorized as Current (raw data values) and Prior (year over year percent growth/decline). I've created some dummy data in Excel to get the format the way I want it in PowerBI (see below):
Desired Format
As you can see the Current values are coming in as integers and the Prior % numbers as percentages which is exactly what I want; however, I was able to accomplish this through a custom column with the following formula:
Revenue2 = IF(Scorecard2[Current_Prior] = "Current", FORMAT(FIXED(Scorecard2[Revenue],0), "$#,###"), FORMAT(Scorecard2[Revenue], "Percent"))
The problem is that the data comes from a SQL query and you can't use the FORMAT() function in DirectQuery. Is there a way I can have two different datatypes in the same column of data? See below for how the SQL data comes into PowerBI (I can change this if need be):
SQL
Create 2 separate measures, one for the Current second for Prior, and format these measures.
Probably you can also use a case in SQL query to format your data to bring it as STRING.
What I wound up doing was reformatting the SQL code to look like this:
Solution
That way Current/Prior are have two separate values and the "metric" is categorical.
I got the idea from this post:
Simple way to transpose columns and rows in SQL?

How to make a Pivot Table in Visual Basic

i´ve got a doubt. I made a Pivot Table with Transform in SQL and now wanted to export it to my VB project. The thing is that according to my teacher I won´t be able to insert that Pivot Table into a Form. She says that i will need to either create a DataGridView or do it in a Listbox.
My pivot table would contain in the rows the Room Type (we are simulating an small hotel and we want to see de income by months) and in the columns the months.
I was wondering if someone has any idea on how i can display this data in a nice way.
Thanks!

Set order of rows in Pivot Table with VBA

I am currently using a Pivot table which is linked to several tables in other sheets in a workbook. However I need to the rows to be ordered as per the Hierarchy I determine when I enter the data. I have the position number in one of the source tables but need to use that data to set the position within the pivot table using some VBA code. I'm not sure if this is possible so any thoughts are appreciated.
Thanks in advance.

Store Input Box Data Temporally in VB.net

I'm trying to create a Windows Form application which will prompt for data to then update a SQL table.
The SQL table requires 3 fields, column A, column B, column C.
To make it easier for the end user, I'm trying to allow them to input all the data in for column C first (As they won't know the relevant data for Columns A and B until the end of the process when they request that data from a third party).
Is there a way to store all the data they add for column C, then at the end request a single piece of information for A and B, which will then populate the other two columns and update the SQL table with these rows?
Thanks
Sounds like you could use a datagridview with ADO.net. Make the datagrid 3 columns wide, and utilize the first column (does it make more sense to fill out the first column rather than third? You can update it back to the database in any order.)to expect the value that you want to capture (you can add more datagrid rows as needed). In order to do this query to the database, you can add a database through dataset designer and create a method to pull/update data to/from sql server.
To get data out of the DB, you could loop through each row of the datagridview, collect the column1 item, pass it as a parameter (if needed) to your new method, receive the data back from the database, fill the the other two columns in the row.
Now that you have that data you could do an entire update into the database using another method created in the dataset designer.

Best Method to Create a Table in Report Builder 3

I am trying to replicate a word document as a report in Reporting Services 2008r2.
I need to create a table, with some cells spanning more than 1 column. Essentially it's a 3 column table, but sometimes the 2nd column should fill the space of the 3rd.
I can't find a good way of creating this in Report Builder 3 - I have tried using a table and matrix but cannot achieve what I want.
This report is for 1 record, I want a table of data related to a record and do not want to create textboxes and rectangles and arrange them neatly to get what i want.
Each field should have its own row - but some of those rows will be split with 2 values.
Does anyone have a good method to create what I want? Please don't tell me this isn't the 'norm' and how to do the normal way - I need to replicate an existing layout.
I have solved my issue by deleting the 'Header' row from the table. Then using it like a normal table in any MS Office app, I have also ensured that my Dataset only contains 1 row which may have had some bearing on my issue...