I have a dataset of action tracking records with due dates. I've been asked to generate a burndown curve, which I can do pretty simply in Excel, but I'm stumped on how to put this in a WebI report.
I created a variable to convert the due date for the records to yyyy-MM, so I can group them by the month they're due and count them. Then, I was able to add a runningsum of those counts in my crosstab.
[
The element that I'm missing is being able to refer to the total count of records (the total outside the column grouping of the crosstab) to subtract the running sum from.
Suggestions?
You need to deal with Calculation Contexts in order to do this. Here are a few good resources...
Removing the Confusion from Calculation Contexts
Calculation Context Part I: Overview
The More Things Change... (de facto Part II to Part I above)
To answer your question and show my work I created a free-hand SQL query using the SQL in this dbfiddle. Put into a crosstab with a running sum I get what you have in your example...
Next I created a variable called Var Report Total defined as...
=Sum([Act Count]) In Report
Then I created another variable called Var Remaining to calculate the difference...
=[Var Report Total] - [Var Running Sum]
And there you have it...
Related
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.
I am not familiar with excel as you can probaly guess by my question so I am sorry if it's a silly question but I have been googling for a long time and I can't do it.
I manage to do it in excel 365 with the function filter, but I can't on excel 2019 (I am required to do it in excel 2019)
I want to identifed the smaller number of a specific combination of cells using two table.
Table1 has name of people and places as well as a number. (the number shows the difference of the last time a person went to a place and the [in months])
(In this project the inspector cannot go to the same place twice unless 4 months have pass, thus why I want the smaller number, using the date of the last visited and the fcuntion now I get teh number of months that have pass)
Table2 has only the name of one person out of these people but has the name of all places. I want to get the smaller number for every place.
This is my table1: (I hided other peoples names so I can show a more compact examlplo)
And this is my table2:
I thought that I could use a function aggregate with a function if inside of it to get only the values that I desire.
It did not worked thou. Was I had miss undertand the fact that function if only gives me true or false. But thought that the aggregate function could wordk. It did not as well
=AGGREGATE(5;3;A2&B2=Table1[#Place]&Table1[#name];1).
overall my question could be summarize to which funtion should I used?
Which function should I use?
obs: In excel 365 I used concat to make a code an thus only used one cell, but I don't see why it wouldn't work if I just select two cells insted of one (teh concat cell)
I'm not too sure how to word this problem so, I apologize for the vagueness. Here is what I am trying to do though:
I have a large Excel table with a ton of values, I however, only care about 3 columns. The three columns I have are "Project Name", "Active/Planned", and "Week of Month". Here is an example of some values I would have:
Project Name
Active/Planned
Week of Month
StoreProj
Active
2021-07 Jul-Wk1
SecProj
Planned
2021-07 Jul-Wk2
StoreProj
Active
2021-07 Jul-Wk1
Now, I have used a formula to get the number of projects based on a specific week month and avoiding duplicate values for the project name. The code I used returns an integer of the number of projects. Here is what I used:
=IFERROR(ROWS(UNIQUE(FILTER(Table[Project Name],Table[Week of Month]=2021-07 Jul-Wk1))), 0)
This works as intended. Now the issue I am running into is that I need to filter through these rows as I did previously, but now I need to include the "Active/Planned" column. So, I want to be able to see how many projects I have based off of the week of the month and return a number of projects (excluding duplicate names), but be able to filter through that integer output based off of the active/planned projects. So in a perfect scenario I can choose the week of month and if the project is "Active" or "Planned" and see the amount of projects I have.
This might be an easy fix so I apologize, I am just stumped, any help would be greatly appreciated. Thanks!
Work through that step by step, you've got the FILTER function which is giving data to the UNIQUE function, to the ROWS function, and then your IFERROR. However, the data about whether each line/row is 'Active' or 'planned' isn't passed out beyond the FILTER function, so can't be used by anything further on in the above sequence.
Boring theoretical advice out the way, try this;
=COUNT(IF(UNIQUE(FILTER( Table[[Project Name]:[Active/Planned]], Table[Week of Month] = "2021-07 Jul-wk1"))= "Active", 1))
Explanation:
FILTER(...) outputs records with the relevant date filter, however it outputs Table[[Project Name]:[Active/Planned]] - both columns, to ensure all relevant data is there.
UNIQUE(...) Then narrows that down to unique values, although by this stage I'm not 100% sure you need this.
IF(... = "Active", 1) then replaces the 'Active' outputs with 1s
COUNT() returns the number of cells in the above that contain a number (the 1s from the IF())
Yes, you can't use COUNTIF on arrays (and all except that last bullet point above are outputting arrays not single values) - and no, I didn't know that before attempting to answer this question, found it over at a different question!
I am unable to sum phone call times that are being stored in a SQL fact table
I have a SQL table of phone call times, by person, which are being used in a Cognos Analytics Data Module.
I would like to use this data in a crosstab and report a total call time in HH:MM:SS for each person.
SQL column is formatted time(0) when I try to Total the time, Cognos throws a [MSR-VRF-1202 The column "Call Length" has the data type "time" and can't be aggregated] error.
What is the correct way to display a total of Call Times.
UPDATE
I have managed to overcome half the problem by using a number of query calculations in Cognos Anaytics.
I updated the SQL fact table to include a new measure of time in seconds then used the query items below.
HH as FLOOR(TOTAL([CALLTIMEINSECONDS])/3600)
MM as FLOOR(([CALLTIMEINSECONDS]-[HH]*3600)/60)
SS as [CALLTIMEINSECONDS]-([HH]*3600)-([MM]*60)
HH1 as IF ([HH]<10) THEN ('0'+CAST([HH],VARCHAR(4))) ELSE (CAST([HH],VARCHAR(4)))
MM1 as IF (MM<10) THEN ('0'+CAST(MM,VARCHAR(2))) ELSE (CAST(MM,VARCHAR(2)))
SS1 as IF (SS<10) THEN ('0'+CAST(SS,VARCHAR(2))) ELSE (CAST(SS,VARCHAR(2)))
ALL TIME as [HH1]+':'+[MM1]+':'+[SS1]
This works in individual Crosstabs rows however will not summarise and also does not work on any charts.
Why would two individuals take the time to read and vote a genuine request for assistance down? I thought this was a place to share knowledge and experience. Clearly these people need to get out more, a life, or get laid. Sorry I can’t help but hopefully someone else will 😉
I'll assume
you would use the terms time and duration synonymously.
you are using MS SQL Server.
Adjust your final solution accordingly.
My solution in SQL is:
format(sum(DATEDIFF(second, TIMEFROMPARTS(0,0,0,0,0), [CallDuration])) / 3600, '0#') + ':' +
format(sum(DATEDIFF(second, TIMEFROMPARTS(0,0,0,0,0), [CallDuration])) / 60, '0#') + ':' +
format(sum(DATEDIFF(second, TIMEFROMPARTS(0,0,0,0,0), [CallDuratoin])) % 60, '0#')
A Cognos-based solution may involve multiple queries. Here are the basic pieces:
Convert the times to numbers.
Sum the numbers.
Convert the summed numbers to times (or time parts -- hours, minutes, seconds).
Format the output.
If you calculate the parts separately, the formatting can be done on the page rather than the query Cognos as 5 text items, some with a Source type of Text and some with a Source type of Report Expression or Data item value. In other words, 3 query calculations and 2 text items.
<hours>:<minutes>:<seconds>
I'm trying to rank some data in spotfire, and I'm having a bit of trouble writing a formula to calculate it. Here's a breakdown of what I am working with.
Group: the test group
SNP: what SNP I am looking at
Count: how many counts I get for the specific SNP
What I'd like to do is rank the average # of counts that are present for each SNP, within the group. Thus, I could then see, within a group, which SNP ranks #1, #2, etc.
Thanks!
TL;DR Disclaimer: You can do this, though if you are changing your cross table frequently, it may become a giant hassle. Make sure to double-check that logic is what you'd expect after any modification. Proceed with caution.
The basis of the Custom Expression you seem to be looking for is as follows:
Max(DenseRank(Count() OVER (Intersect([Group],[SNP])),"desc",[Group]))
This gives the total count of rows instead of the average; I was uncertain if "Count" was supposed to be a column or not. If you really do want to turn it into an average, make sure to adjust accordingly.
If all you have is the Group and the SNP nested on the left, you're done and good to go.
First issue, when you want to filter it down, it gives you the dense rank of only those in the filtered set. In some cases this is good, and what you're looking for; in others, it isn't. If you want it to hold fast to its value, regardless of filtering, you can use the same logic, but throw it in a Calculated column, instead of in the custom expression. Then, in your CrossTable Aggregation, get the max of the Calculated Column value.
Calculated Column:
DenseRank(Count() OVER (Intersect([Group],[SNP])),"desc",[Group])
Second Issue: You want to pivot by something other than Group and SNP. Perhaps, for example, by date? If you throw the Date across the top, it's going to show the same numbers for every month -- the overall numbers. This is not particularly helpful.
To a certain extent, Spotfire's Custom Expressions can handle this modification. If you switch between using a single column, you could use the following:
Max(DenseRank(Count() OVER (Intersect([${Axis.Columns.ShortDisplayName}],[Group],[SNP])),"desc",[Group],[${Axis.Columns.ShortDisplayName}]))
That would automatically pull in the column from the top, and show you the ranking for each individual process date.
However, if you start nesting, using hierarchies, renaming your columns, or having multiple aggregations and throwing (Column Names) across the top, you're going to start having to pay a great deal to your custom expression. You'll need to do some form of string replacement around the Axis.Column, or use expression instead of Short Names, and get rid of Nests, etc.
Any layer of complexity will require this sort of analysis, so if your end-users have access to modify the pivot table... honestly, I probably wouldn't give them this column.
Third Issue: I don't know if this is an issue, exactly, but you said "Average Counts" -- Average per day? Per Month? When averaging, you will need to decide if, for example, a month is the total number of days in month or the number of days that particular payor had data. However you decide to aggregate it, make sure you're doing it on the right level.
For the record, I liked the premise of this question; it's something I'd thought would be useful before, but never took the time to try to implement, since sorting a column or limiting a table to only show the top 10 values is much simpler