I have got the following MDX statement in icCube (based on the standard Sales model):
with
set [time-set] as hierarchize({[Time].[Calendar].[All Periods],[Time].[Calendar].[Year].members,[Time].[Calendar].[Year].[2009].children},post)
member [issue] as [amount], caption = "drill down on 2008"
select [issue] on 0
, [time-set] on 1
from sales
This gives the following result:
When clicked on 2008:
I assume the IDE is a bit mixed up since I have used the POST command. Is there a workaround to get it working as expected?
Short answer.
Sorry, the current version of iccube's pivot table is not supporting the post flag.
Related
My BASE Code
I have a set of data that, where I wanted to grab the Top N with highest SumOfAmount values, FOR EACH Status Detail value. To do this, I used:
SELECT
[Report_SubstatusVsInsurance_Top3_Q, Part 1].[Status Detail],
[Report_SubstatusVsInsurance_Top3_Q, Part 1].Insurance,
[Report_SubstatusVsInsurance_Top3_Q, Part 1].[CountOfInvoice No],
[Report_SubstatusVsInsurance_Top3_Q, Part 1].SumOfAmount
FROM [Report_SubstatusVsInsurance_Top3_Q, Part 1]
WHERE (([Report_SubstatusVsInsurance_Top3_Q, Part 1].SumOfAmount In
(
SELECT TOP 3 SumOfAmount
FROM [Report_SubstatusVsInsurance_Top3_Q, Part 1] as t
WHERE t.[Status Detail] = [Report_SubstatusVsInsurance_Top3_Q, Part 1].[Status Detail]
ORDER By SumOfAmount DESC))
);
NOTE: Using the WHERE subselect allowed me to get the FOR EACH Status Detail element of my query. Simply using SELECT TOP 3 would only provide me with top 3 charges overall.
My Problem
Long story short - it looks like the order required by the WHERE subselect criteria is preventing further sorting in the primary query.
Now that I have the results I want, I'm trying to display them properly. I'm trying to sort by Status Detail. I tried posting my code here, but it wouldn't format properly - the code was simply the "My BASE Code" above, plus, right between the final ) and ; was:
ORDER BY [Status Detail];
When executing this query, I get the error:
Data type mismatch in criteria expression.
Troubleshooting
I've tried:
Adding the ORDER BY statement directly to the query (see stated above). This results in the "data type mismatch" error.
Using a report, and sorting the report by Status Detail. I still get the same error.
Using a second query built from this query's results, and sorting that. I still get the same error.
Any help would be greatly appreciated. Thanks!
I have started to create a Query by Form using the Form QueryHelp and the Query called DEALLOG3. My goal is for the user to be able to filter by Submarket, Building Type, and a sale date range. With the criteria I have now, it works fine in most scenarios where all of the comboboxes have values. However, when one of the comboboxes is blank, I want to be able to still have the other two criteria working, while showing all of the records for the blank field. (ex: Tampa Submarket, [Blank] Building Type, and a sale date from 01/01/2000 to 01/01/2016).
I've been scouring this sight for the past two days and can't find anything that will work. I think I might be looking for a dynamic query, but I am unsure. Here is what I have currently, please let me know if you can help:
SELECT DEALLOG3.PROPERTY, DEALLOG3.CODE, DEALLOG3.CLOSED, DEALLOG3.Submarket, DEALLOG3.NRA, DEALLOG3.PRICE, DEALLOG3.OCCUPANCY, DEALLOG3.[5 YR IRR], DEALLOG3.PURCHASER, DEALLOG3.SELLER, [PRICE]/[NRA]
AS PSF, [DEALLOG3]![NOI]/[PRICE]
AS [Cap Rate], DEALLOG3.[Building Type]
FROM DEALLOG3
WHERE (((DEALLOG3.CLOSED)
Between [Forms]![QueryHelp]![closeyear1]
And [Forms]![QueryHelp]![closeyear2])
AND ((DEALLOG3.Submarket)=IIf(IsNull([Forms]![QueryHelp]![Submarket]), " * " ,[Forms]![QueryHelp]![Submarket]))
AND ((DEALLOG3.[Building Type])=IIf(IsNull([Forms]![QueryHelp]![BuildingType]),"*",[Forms]![QueryHelp]![BuildingType])))
;
Try again after changing your WHERE clause in
WHERE DEALLOG3.CLOSED Between [Forms]![QueryHelp]![closeyear1]
AND [Forms]![QueryHelp]![closeyear2]
AND (
DEALLOG3.Submarket)=[Forms]![QueryHelp]![Submarket])
OR [Forms]![QueryHelp]![Submarket] Is Null
)
AND (
DEALLOG3.[Building Type])=[Forms]![QueryHelp]![BuildingType]
OR [Forms]![QueryHelp]![BuildingType] Is Null
)
Okay I am getting stuck with my code.
What I am trying to do is use specific data from multiple tables, but I want to use basically the UNION ALL and INNER JOIN functions, however, this is not supported with the Visual Basic of Access and I require it to go to a table so that I can proceed to my next step.
The whole interface work from a form that has buttons to press for normal users, basically setting up a whole interface for importing the reports.
My original import followed the advise that I received from here for the tables:
strSQL = "INSERT INTO [Clicks Returns] " & _
"(SKU, [Item Description], [Jan 2016 FIN YTD TY % Returns]) " & _
"SELECT Sku, [Item Description], [Jan 2016 FIN YTD TY % Returns] FROM [Jan 2016 Clicks Returns];"
DoCmd.RunSQL strSQL
This works perfectly for appending the data to one table, however when importing the data from multiple tables into one table it follows this pattern:
Result Example
However, I require this to be the result:
Required Result
The issue is that Both SKU numbers would be similar and the Item Desc. would be the same.
And with the normal append method it just keep duplicating and I want it to follow a join type action, and I do not know how to approach this exactly with Visual Basics on Access.
Thank you for taking the time to review this and also providing assistance.
with getting the information from the second table, you require the table to be updated. (so insert into won't work for the second time you need to get data...)
I would however reconsider your data structure, to have 1 data column in the table, and have 1 column indicating which month. Then when reporting you can pivot that information...
so basically this table format:
1) SKU
2) Item Description
3) Month
4) Month YTD information.
In the case above, your insert into will much more easily work, and you won't need an update statement.
I hope this helps.
Kind regards,
I'm new to SSAS and need help with what would be equivalent to a where clause in SQL and I'm sure an easy answer for a MDX regular.
I have this pulling values for a multiple select parameter list in report builder but I need to filter out the contracts based on what project the user is currently viewing. Here is the query that is pulling all the values correctly.
WITH MEMBER [Measures].[ParameterCaption] AS [dimContracts].[ContractName].CURRENTMEMBER.MEMBER_CAPTION
MEMBER [Measures].[ParameterValue] AS [dimContracts].[Contract Name].CURRENTMEMBER.UNIQUENAME
SELECT {[Measures].[ParameterCaption],
[Measures].[ParameterValue]} ON COLUMNS,
[dimContracts].[Contract Name].Children ON ROWS
FROM [cubeProjectEntities]
I need to add what would be equivalant to:
WHERE dimContracts.[Project Id] = 1
I've added which produces the correct filtered set but from here I don't know how to use the report parameter to get it to work. Every time I test it just gives and empty dataset. I have the parameter just printing on the page so I know that it is set correctly.
WHERE [dimContracts].[Project Id].[1]
This does not work:
WHERE [dimContracts].[Project Id].[#ProjectId]
And then in Report builder I will pass a parameter to the query to replace the 1 for #projectId.
Thanks for any help!
WITH MEMBER [Measures].[ParameterCaption] AS [dimContracts].[ContractName].CURRENTMEMBER.MEMBER_CAPTION
MEMBER [Measures].[ParameterValue] AS [dimContracts].[Contract Name].CURRENTMEMBER.UNIQUENAME
SELECT {[Measures].[ParameterCaption],
[Measures].[ParameterValue]} ON COLUMNS,
[dimContracts].[Contract Name].Children ON ROWS
FROM [cubeProjectEntities]
Where (STRTOMEMBER(#projectid))
In MDX, the where clause is a slicer. Here's a good article about the differences between SQL and MDX.
Here's a link about using SSRS parameters with MDX queries. You'll actually want to pass the entire member name to the query rather than just the value (ex: [DimContracts].[Project ID].[1])
I need to create a report using SSRS 2008 that will show the top 10 advertisers by revenue. I wrote the MDX query in management studio as follows:
Select [Measures].[Value] on 0,
non empty
generate([Dim Industry].[SK Industry ID],
topcount([Dim Advertiser Branch].[Advertiser],
[Measures].[Value],bdesc),10)
on 1
from FuseCube
I get a parse error stating:
Query (5, 20) An expression was expected for the function argument and no expression
was detected.
My goal is to report the top 10 Advertisers, their associated branch and industry by Value (aka revenue). The remaining ranked advertisers should go into an "others" category so that I can sum the value and get a grand total.
How should I restructure the above MDX query to produce desired results? Is it advisable to create the above query as a named set as it will be used repeatedly?
TOPCOUNT syntax incorrect:
topcount([Dim Advertiser Branch].[Advertiser], [Measures].[Value],bdesc),10)
Vs
TopCount([Dim Advertiser Branch].[Advertiser], 10, [Measures].[Value]))