Time table in SSAS Cube has all correct dates. And Data source view also has the correct data for those dates. However why Excel pivot table does not retrieve data from the specific week? (3rd week in the year)
Only 3rd week data is being missed in Excel pivot table.
enter image description here
Could a filter in the pivot table be on by accident? Not in the data, but the table itself. Maybe a date got unticked? this could cause it.
example of pivot filter
It's probably unlikely, but it could be that there's no data in that week for the measure you've selected. Do you see the week if you browse the time dimension itself in SSDT?
Related
I have created a view for the Leco results and it is attached here as ‘Leco Teble’ excel file. I would like to have same view in database with ‘expanded table’ column based on the sample ID’s as given in the expanded table. Would you please arrange with one of your team member to create a script to expand the table in the same view. Last column in the table “Shift” should be picked up based on the time with the sample ID. 6am to 6pm is day shift.
I have a SQL server database table that contain a few thousand records. These records are populated by PowerShell scripts on a weekly basis. These scripts basically overwrite last weeks data so the table only has information pertaining to the previous week. I would like to be able to take a copy of that tables data each week and add a date column with that day's date beside each record. I need this so can can do trend analysis in the future.
Unfortunately, I don't have access to the PowerShell scripts to edit them. Is there any way I can accomplish this using MS SQL server or some other way?
You can do the following. Create a table that will contain the clone + dates. Insert the results from your original table along with the date into your clone table. From your description you don't need a where clause because the results of the original table are wiped out only holding new data. After the initial table creation there is no need to do it again. You'll just simply do the insert piece. Obviously the below is very basic and is just to provide you the framework.
CREATE TABLE yourTableClone
(
col1 int
col2 varchar(5)...
col5 date
)
insert into yourTableClone
select *, getdate()
from yourOriginalTable
I imported a Time Dimension from an excel spreadsheet to SQL Server.
The time dimension start date is 2005-07-01 to 2025-12-31 (aussie format)
Tha attributes is composed of
TimeKey Date Date_Name Year Year_Name Half_Year Half_Year_Name Quarter Quarter_Name and all the way to fiscal attributes.
Anyways, when I created this TimeDim in the excel spreadsheet, it was in order, arranged properly from 2005-07-01 to 2025-12-31. I imported the spreadsheet in sql server then when I query using a select * from TimeDim.
The results are shuffled, dates are disarray.
Is there anyway to fix this? Im willing to truncate or drop the table then import the spreadsheet again so long it could fix the problem.
Many Thanks!!
Beau
The order in which a table stores data is dependent on the clustered index that you define.
However, even if you define a clustered index for your date column, simply selecting the entire table does not guarantee that your data will be returned in that order.
The only way to guarantee data is selected in your desired order is by specifying the ORDER BY clause in your select statement.
I'm using one of my MySQL database tables as an actual table, with times of the day as each column, and one column called day. You guessed it, in day it says the day of the week, and in the rest of the cells it says what is happening at that time.
What I want to do is only show the cells that have value in it. In my case, I'm always going to have all the rows and 2 columns full. The 2 columns are 'day' and '19:00', however in the future I might add values for '18:00' etc.
So, how can I only SELECT the columns and rows which have data in them? Some type of 'WHERE: there is data'?
Thanks!
EDIT: Picture
Having time or day as columns means that you have data in your field names. Data belongs inside the table, so you should normalise the database:
table Calendar
--------------
Day
TimeOfDay
Appointment
This way you don't get a lot of empty fields in the table, and you don't have to change the database design to add another time of day.
Now you can easily fetch only the times that exist:
select Day, TimeOfDay, Appointment from Calendar
From what I gathere you are looking something along the lines of
WHERE col1 IS NOT NULL
But it would be helpful if you could elaborate more on your schema, especially if you could draw a sample table.
I am in a mission to devise an application database in MS ACCESS. In my database there are 5 tables:
Master
Cash
Cheque
Detail
Month (displays month in a year)
Here I have made Master as parent record and 3 others Cash, Cheque and Detail are children to Master table.
Here are the fields in master table
Lt no Name Regfee AssessmentYear April May June .......... March
The last 12 fields are months in a financial which takes amount as value.
These values should be populated from cheque/cash table through a query.
cheque
LTno **month** chqueno date bank **amount** are fields.
In this cheque table amount for a particular month is to be populated on master table for the corresponding month. What query do I make.
Expecting your valuable suggestions.
As the database is not normalised, you will have to make a very complicated query to update the table. You have to either make twelve updates that look almost the same, or a huge query that does almost the same thing twelve times.
It would be better to move the month values out of the master table and into a separate table where the month is a field in the table instead of a field name. Then it would be easy to add the records to it:
insert into MasterMonths (LTno, month, value)
select LTno, month, sum(amount)
from cheque
group by LTno, month
I do something similar, except that I include credit card slips and cash purchases as well as checks. It's basic bookkeeping.
For a variety of reasons, I chose to have a table called "almanac" with one row (record) for every date. There are columns (fields) for such things as day of the week, month of the year, and so on. I populate this table with a little code fragment written in VB. Even with ten years worth of dates, that's only about 3,653 rows in the table. I then use simple joins with this table to reduce transaction data to data that's summarized by month. I can summarize in other ways, too.
The query is so easy that I just did it with the graphical query interface. However, my summary would have twelve times as many rows as yours, with only one month in each row.
When I want data laid out in the format of your master table, I use one of two tools: the crosstab query tool in MS Access, or the Pivot Table tool in MS Excel. They are both very powerful, but the pivot tool is more flexible. I had to install an add in called MS query in Excel in order to query database data from Excel. That may be a function of the version I'm using.
This is very different from your framework, and it's your choice whether to use it. It's worked well for me.