Analysis Services Cube hierarchy total - ssas

I cannot understand how hierarchy works in cubes. I have AdventureWork 2014 database example and I'm using MDX to query it. For example I want to get values of orders of each product in Australia country. My results:
If calculate manually, to sum of orders: 1713, what has big difference with total in the cube:
Does anybody know how this works?

Related

AdventureWorks - Query Sales of Bikes, by Color, Month, Territory

I'm trying to query the AdventureWorks OLTP Database for something specific, and I can't figure out where in the schema I should be pulling specific pieces of information from.
Say I wanted to find the sales of white mountain bikes in July 2012, then output Total Number of Sales, Total Number of Bikes Sold by sales territory, how would I even begin finding this information in the schema, much less join it together?
Just generally gooning around the database, I found the following pieces of information:
sales.SalesOrderHeader.OrderDate - Date of Sale
sales.SalesTerritory - Territory of Sale
sales.SalesOrderHeader.OnlineOrderFlag - 0 for Sales Person
production.Product.color - Color of Bike
production.Product.name - Designating Mountain Bikes
But I'm not certain how to query these tables and arrive at my answer.

About Aggregage/Sum column in SSAS Cube

I am working on a simple project using SSAS Cube on SQL Server 2016 and SSDT2015. DW_Orders database is from Orders DW. The table factor orders contains attributes UnitPrice, Quantity and Discount with the calculation member TotalSale defined as [Measures].[Unit Price][Measures].[Quantity](1-[Measures].[Discount]), well as the FK members CustomerID and OrgID. I want to get the TotalSale based on Country-City Hierarchy from dimension dimCustomers. But I got the following result:
enter image description here
it is obvious that the UnitPrice, Quantity and Discount have been summed under the city or country so that we got wrong and negative result of TotalSale from the calculation. Tried in the Edit Measure, cannot get what I expect. Need your help on some settings, thanks.
You need to edit the aggregation type for the 2 measures(discount and unit price). By default, the type is SUM, you need to use Average. To do that, go to the measure group, select the measure and access its properties to set the aggregation.

How do I group nodes by a different node property and order by a different one in Neo4j?

I am working with crimes in Boston dataset, with each crime as nodes in Neo4j. I want to query and display the most committed crimes each year to get a result like this:
Year
offense_code_group
count(offense_code_group)
2015
Aggravated Assault
5827
2016
Larceny From Motor Vehicle
11534
2017
Verbal Disputes
12049
2018
Investigate Person
8724
Note: The result is just an example of how I want it to group and look, not the actual result I'll get after querying the dataset.
But this is the best I have been able to do so far:
query and output in neo4j desktop
I know there is no GROUP BY clause in Neo4j and I have tried using collect(), but I can't get it to work.
How about something like this:
MATCH (c:Crime)
WITH c.year AS year, c.offense_code_group AS code, count(c.offense_code_group) AS count
ORDER BY year, count DESC
WITH year, COLLECT(code) AS codes, COLLECT(count) AS counts
RETURN year, codes[0], counts[0]

From ssas multidimensional cube, How to get top sales from factsales by salesPoint and month

I am using SSAS Multidimensional cube.I have factsales and two dimdate,dimsalespoint table. I need to show top sales every month by sales point.Also i need to show this data into power bi.My cube brower will be look like
July salespoint1 1254
Aug Salespoint2 2589
Sep SalesPoint3 85236.
Per month which sales point sales high.
It will also filter year, product etc.
Can any one help me.
I think that you can do this with only PowerBI
You juste need to drag you sales infos and select max aggreagate and filter them by month and salespoint.
In powerBI you connect to your cube
you drag and drop your salesvalue and select the matrix visual
you use salespoint in row , date in column and salesvalue in values
You can select a max aggregate on your values
You'll get something like this :
and you can navigate in the date hierarchy by using the arrow on the top right
If you use a live connexion with an OLAP cube.
You can replace you max in powerBI by doing these step :
and select max
you then have to use this measure in the powerBI report because it will be based on your table filtered by what you put in the visual(date, salespoint,...)

Tableau: How to calculate a revenue share for a company's product inventory against their competition?

I have been struggling on this problem on Tableau for a while and would really appreciate some help.
For a given company A that has product_id's 1,2,3....,N
How do I calculate their share of revenue for a given product id against other companies B,C,...., N with the same product id?
===========================================================================
My current idea has been to duplicate the data source and then do a simple table calculation:
SUM([Revenue])/SUM([Duplicate_Data].[Revenue])
I can then add this calculated measure to the sheet and filter to show the SUM of revenue for company A against all other companies in the duplicate data source. However, this does not aggregate by product id as I would like it to.
Thanks in advance.
Hamza