I'm taking data from the Database for loading into qlikview.
I have to create a chart with the percentage of inflow tickets group by SR(Column name). How do ido that? The expression for numerator and denominator looks the same to me. Is there a way to group by?
If I understand your question correctly you're trying to build something that looks like this
To add the relative % all you have to do is copy and paste the expression for the sum of calls and then add the relative tick to the 2nd expression
Notice that the expressions are exactly the same except for the relative tick. This tells QlikView to divide the dimensional answer by the dimensionless total.
Related
I am using Google Standard SQL with Big Query. I have the following code to get a variance and standard deviation from a table, however, the aliasing is not working. The column names return as f0 and f1 and not Variance and StdDev.
#StandardSQL
SELECT VARIANCE(Results) AS Variance,
STDDEV(Results) AS StdDev
FROM `totals`
Screenshot of output
You're seeing this apparent problem because the query is overwriting a table that previously had those column names.
If you do a
SELECT * FROM `bikes-data.bikes_data.var_and_stddev`
you'll find out that the table has the correct column names.
Somewhere on the display code the previous column names were cached, but your query is working as expected. You can also solve this problem by refreshing your browser tab.
I filed this as a bug: https://issuetracker.google.com/issues/128651254.
I have an access database that has an id referring to a customer who has trucks of different sizes. currently the table looks something like this:
id.....tire size
1......30
1......30
1......31
1......31
2......32
What I want to achieve is something like this:
id.....30.....31.....32
1......2......2......0
2......0......0......0
where it counts the number of occurrences of a specific tire size and inputs it into the respective tire size column.
In order to display the data as you have written it, you will need to do a crosstab query. The code below should achieve what you want
TRANSFORM Nz(Count([YourTable].[Tire Size]),0) AS [CountOfTire Size]
SELECT [YourTable].[ID]
FROM [YourTable]
GROUP BY [YourTable].[ID]
PIVOT [YourTable].[Tire Size];
The first step would be a query like:
select tire_size, COUNT(id) from mytable
GROUP BY tire_size
(I put the "special magic" parts of that query in UPPER CASE for emphasis.)
In the MS-Access query-builder, grouping features are accessed by clicking a button that looks vaguely like an "E" (actually, a Greek "epsilon" character), if I recall correctly. This adds a new "grouping" row to the query-builder grid.
This will produce (as you will quickly see) a row-by-row result with tire-size and the count of id's for that tire-size.
Many other variations of this are possible. Read the MS-Access on-line help which discusses this feature: they did a very good job with it.
The essential idea is the GROUP BY clause: this says that each distinct value of tire_size forms a "group." (Yes, you can GROUP BY more than one column, in which each unique combination of values forms one group.) Then, you specify so-called "domain aggregate functions, such as COUNT(), AVG(), SUM(), to produce summary statistics for each group.
Every GROUP BY column must appear in the SELECT clause, and every other item that appears there must be a domain aggregate function. (Which, if you think about it, makes perfect sense ...)
(Fortunately, MS-Access's query builder does a good job of "hiding" all that. You can build a grouping-query interactively, thanks to that "epsilon" button. But it's useful then to look at the "SQL View" to see what it did in SQL terms.)
Use the 'GROUP BY' aggregator
You'll need something like this:
SELECT
tyre_size,
count(id)
FROM tablename
GROUP BY
tire_size
I'm trying to run the following MDX query (I'm newbie in the matter):
WITH MEMBER [Measures].[Not Null SIGNEDDATA] AS IIF( IsEmpty( [Measures].[SIGNEDDATA] ), 0, [Measures].[SIGNEDDATA] )
SELECT
{[Measures].[Not Null SIGNEDDATA]} ON COLUMNS,
{[Cuenta].[818000_001],[Cuenta].[818000_G02]} ON ROWS
FROM [Notas_SIC]
WHERE ([Auditoria].[AUD_NA],[Concepto].[CONCEPTO_NA],[Entidad].[CCB],
[Indicador].[INDICADOR_NA],[Interco].[I_NONE],[Moneda].[COP],
[Tiempo].[2010.01],[Version].[VERSION_NA])
Where 818000_001 is a base member of my 'Cuenta' dimension, and 818000_G02 is a node or aggregation. I receive the following message:
"Two sets specified in the function have different dimensionality"
What am I doing wrong? If I put the query with only base members (many) or only differents aggregations, the result is ok as expected.
Thanks in advance!
By using commas in your WHERE clause, you are trying to create a set out of members from different dimensions. You should use asterisks to make a CROSSJOIN instead.
So replace this:
WHERE ([Auditoria].[AUD_NA],[Concepto].[CONCEPTO_NA],[Entidad].[CCB],
[Indicador].[INDICADOR_NA],[Interco].[I_NONE],[Moneda].[COP],
[Tiempo].[2010.01],[Version].[VERSION_NA])
With this:
WHERE ({[Auditoria].[AUD_NA],[Concepto].[CONCEPTO_NA],[Entidad].[CCB]} *
{[Indicador].[INDICADOR_NA],[Interco].[I_NONE],[Moneda].[COP]} *
{[Tiempo].[2010.01],[Version].[VERSION_NA]})
I added curly braces though I'm not sure if they're absolutely required.
This is maybe your problem:
{[Cuenta].[818000_001],[Cuenta].[818000_G02]} ON ROWS
You have put them as a set but you can only make a set out of members with the same dimensionality. From your description it sounds like [Cuenta].[818000_G02] is being classed as a different hierarchy which is unexpected.
Is [Cuenta].[818000_G02] created using the Aggregate function? Can you swap to using the Sum function? Does the script then work?
(not a great answer - just more questions?)
{[Cuenta].[818000_001],[Cuenta].[818000_G02]}
Your problem probably lies in the above statement. As is clear, they could be from different hierarchies(which is not clear from your example and I come to that below).
Try replacing the above with
{[Cuenta].[Hierarchy1].[818000_001]} * {[Cuenta].[Hierarchy2].[818000_G02]}
where Hierarchy1 and Hierarchy2 are the hierarchies to which these members belong. (If you are not sure, just try {[Cuenta].[818000_001]} * {[Cuenta].[818000_G02]}). I am assuming that the second aggregate members may be built on a different hierarchy and thus the engine is throwing an error.
It is generally a good habit to always use the fully qualified member name because then the SSAS engine has to spend less time in searching for the member.
I am trying to run an IF statement in Google Spreadsheet that will, if "Yes" SUM a series of values.
=IF(G3="Yes",=SUM(C3*D3)+(E3*D3))
This works (if I ignore the IF) and just do =SUM(C3*D3)+(E3*D3), so I know my math is correct.
I have read a few different posts that are asking similar questions, but many have "guesses" and are offering different structured formulas, so I'm not really even sure what the proper structure is any more.
Basically, for the nerdy portion of you, the spreadsheet does the following:
If the "killed" column is Yes, I need to calculate the XP of the monsters killed.
Base XP (C3) times Qty (D3), plus Bonus XP (E3) times Qty (D3) and them SUM the value.
The equal sign (=) in front of SUM should not be there. If your formula works I guess Google Docs just ignores it. Also, the function SUM() is useful to add the values from a range of cells from the same row or column when you don't know in advance how many cells you will add (or there are more than 2 cells and you use SUM() because it's less to write).
If I understood your request, the formula you need is:
=IF(G3="Yes",C3*D3+E3*D3)
Right now the SUM function is only wrapping C3*D3 then you are adding (E3*D3). This is the same as (C3*D3)+(E3*D3) not using the SUM function. Order of operations tells us there is no need for the parentheses so you could write C3*D3+E3*D3.
The IF function has the following parameters:
IF(EVALUATION,IF TRUE,IF FALSE)
So your final equation would be:
=IF(G3="YES",C3*D3+E3*D3,"")
I always add the FALSE return to be blank so that if I need to change it later I can do so.
How to resolve the below expression:
sum({<Category={'Internal Ops SLA'}>}(RangeSum(Above(sum(InternalOpsSLA),0,12))/TargetOpsSLA)*Weight)
It is giving the error in expression, because of the double sum.
The multiplier Weight value is selected as per the category in the set expression modifier. Is there any other way, apart from variable with ONLY as I need to sum the final results, for the above expression ?
I know this post is pretty old. Responding to it, thinking that it might help a few.
I faced a similar problem in qlikview, while trying to compute Sum of Averages. With an error message:
(Error in expression: Nest Aggregation not allowed)
I realized that one work around for this is to use, aggregate functions. Instead of grouping them like:
sum(avg(<Dimension_Name>condition))
I grouped them as:
Sum(Aggr(Avg(condition), Dimension_Name))
and this worked well for me.
So for your problem, I would try something like this:
sum(aggr(if(Category = {'Internal Ops SLA'},(RangeSum(Above(sum(InternalOpsSLA),0,12))/TargetOpsSLA)*Weight),'Dimension Name'))