Manually change Numeric parameters for OLAP formula - excel

I had created a Pivot which uses Power Bi model as it's data source (Analysis services). Since my data is huge and there limitations of pivot, I am exploring other ways of pulling the data.
I converted the sample Pivot to Olap Formula and I think this is the best solution from all the options I have explored. But there is some odd situation I am facing where I need some help.
I tweaked the structure as shown below. So now whenever I change any string like in the below example if I manually change the currency from SGD to USD, I am getting the result. But whenever I try to Manually change any numeric value like Segment, I am getting #N/A. The same numbers when pulled using pivot gives the number.
I have tried to insert the numeric value in following ways
40
'40
="40"
=text("40",0)
text to columns->text
but till now I am not able to crack this.

The cubevalue function expects dimensions on which it is going to filter the values. If you want to provide the value manually you'll have to do it like this:
=CUBEVALUE("Sales","[Measures].[Profit]","[Time].[2004]","[All Product].[Beverages]")
Meaning you'll have to change the 40 to something like [MyDimension].[MyHierarchy].[40]

Related

sum up days using only existing Excel formulas

I would like to sum up date periods and sum the days per item.
The input data will grow over time and new item categories can appear, so the items (number of rows) that show in the expected report can not be "hardcoded".
The input parameter is the from and to date that determines the period that must be considered. You can imagine this as a moving date window on the input data grid.
I am a Java programmer and I am sure that I can write a proper SQL that groups and sums the data and generate the result. And I can write a Java program too, that does the job, but I really want to do this calculation from Excel.
Is there any way to generate the report by using only a combination of existing MS Excel formulas without writing any Visual Basic code (macro)?
If yes, then could you please put me in the right direction and tell me which formulas I can use? Then I can figure out how to use the formulas.
I hope that this helps to understand better what I would like to have:
Try:
Formula in F3:
=SUM(COUNTIFS(C:C,E3,A:A,"<="&SEQUENCE(H$2-F$2,,F$2),B:B,">="&SEQUENCE(H$2-F$2,,F$2)))
Note that range references that take whole columns will take long to process all data. The above will work even with overlapping dates.

How to sum negative numbers in a pivot table using calculated fields?

I've got some accounts data that I'm trying to manipulate and present but I can't seem to figure this out... I've got an "Amounts" (£) column (among many others) that I've put into a pivot table and I'm trying to use the calculated field function to separate the minuses (income) from the positives (expenses), but it won't allow me to when I enter the formula. Any suggestions? [without manipulating the source data!]
So, I've already tried entering the formula: =IF(Amount<0, Amount, 0) for income (as a negative would be, in my case, an income). I've also tried =Amount<0 and =IF(Amount<0, Amount*1, 0), but none seem to work at all. SOS!

SSRS - Lookup field exported shown as #Error

I was wondering if anybody else came across the same problem. It's been bugging me for weeks now.
I have a big table in my report pulling data from DataSet A, one column contains data from DataSet B and is pulled using the followin:
=Lookup(Fields!Date.Value, Fields!Date.Value, Fields!Sales.Value, "Sales")
Running report shows no errors, all numbers are displayed. However when I export the report to any format (tried CSV, EXCEL, PDF) the value from lookup column comes as #Error (CSV, PDF) or #VALUE! (EXCEL).
Looking for any help on the internet proved to be unsuccessful. Is there anybody who stumpled upon the same problem?
If you can lookup the data field from another dataset properly, it should not be the issue on lookup() function. I've also tested in my local environment, the data can be rendered after exporting. In this scenario, I suggest pay attention to the data type and data length. Can you show the sample data in your BIDS/SSDT?
Turns out it was the fact that I was returning more than one row from the other dataset (not always but in some cases yes). Normally I would create calculate field (different currencies and sales value) and sum them in the report. SSRS didn't have problem showing the first value by default but export functionality failed, since I did't SUM() rows that were find. I change the Dataset then to calculate the values after currency conversion and them wrapped it in another select statement to make sure I only have one for my Date.Value

How to optimize COUNTIFS with very large data

I would like to create a report that look like this picture below.
My data has around 500,000 cells (it will continue to grow larger)
Right now, I'm using countifs function from excel but it takes a very long time to calculate. (cannot turnoff automatic calculate)
The main value is collected as date and the range of date is about 3 years, so I have to put a lot of formula to cover all range of value.
result
The picture below is the datasource the top one cannot be changed. , while the bottom is the one I created by myself (can change). I use weeknum to change date to week number.
data
Are there any better formula or any ways to make this file faster? Every kinds of suggestions are welcome!
I was thinking about using Pivot Table, but I don't know how to make pivot table from this kind of datasource.
PS. VBA is the last option.
You can download example file here: https://www.mediafire.com/?t21s8ngn9mlme2d
I will post this answer with the disclaimer that it is entirely dependent on the size of the data set. That turning on and off the auto calculate is the best way, but your question doesn't let me do that, so keep reading.
Your question made me curious, so I gave it a try and timed it. I essentially set up two columns of over 100,000 rand numbers choosing from 1-1000 and then tried to do a countif on the two columns if they were equal. I made a macro that I can run that turns off the autocalculate, inserts the start time, calculates, and then inserts the finish time. I highlighted in yellow the time difference.
First I tried your way, two criteria, countifs:
Then I tried to combine (concatenate) the two columns to see if I could make it easier by only having one countif criteria and data set. It doesn't. see result below:
Finally, realizing what was going on. I decided to make the criteria only match the FIRST value in the number to look for. I was essentially reducing the number of characters to check per cell. This had a positive result. See below:
Therefore my suggestion is to limit the length of the words you are comparing in anyway possible. You are mostly looking at dates, so you might have to get creative, but this seems to be the best way possible without going to manual calculation.
I have worked with Excel sheets of a similar size. Especially if you are using the data on a regular basis, I would heartily recommend switching to a proper database SQL based, Access, or whatever fits your purpose. I does wonders for the speed and also you won't run into the size limits of Excel. :-)
You can import the data you have now fairly easy.
I am happy as a clam with my postgresql db.

Which is the most flexible way for end-user to create a report querying an SSAS Cube?

I know that you can query a cube by connecting from Excel to Analysis database and using formulas like cubevalue() or cubemember().
I also know that after converting the power pivot to formulas, you can access the attribute and the value related only by writing a text.
Example: for Branch Dimension, instead of writing
cubemember("connections";"[DimBranch].[Name].[All].[London])" )
you can write in the cell only "London". However, this won't work if you have a parent-child dimension and want to retrieve the amount for one of the intermediate levels.
Did anyone know about how can you avoid writing these formulas directly by the end-user ?
I´ve done this several times. I can describe the approach I´ve used in the past.
You need to define the input from the user, for example Fiscal Year, Fiscal Period,... and create a tab with a friendly layout for this solely purpose.
After that you create your pivot/pivots against the cube/s you want to query with the data extraction that you need (obiously these pivots will refer to the Fiscal Year and Period). Define the desired layout for these pivots (as you want them you be shown). Once You´ve done this, you need to convert into formulas these pivots, including parameters. You´ll see that values placed in the measure box contain a formula cubevalue which makes reference to the connection itself and several cubemembers. It makes reference to the measure as well.
The trickiest part comes now, when you need to modify your cubemember function to take value from the input, something like cubemember("connections";"[DimBranch].[Name].[All].["+MyReferenceCell+")" ), and you have your dimension picked up from a value entered by a user.
If you have as a matter of fact, serveral pivots referencing common dimensions, you need to make the reference this modified cubemember cell affected by user input, otherwise you have to modify all affected cubemembers in your pivots converted to formulas.
This has a really good advantage: depending on the excel´s version, all pivots are automatically recalulated if you change the value in the user´s input cell without hitting the refresh all button.
On the other hand, the disadvantage comes when your report in excel contains a list of values from a dimension which can grow. After converting pivots into formulas those new values for the dimension are lost. That´s why you can always place a control if you have the total value int he pivots regardless the dimension value.
I hope this helps.
Regards

Resources