what is the use of total(currentMeausure within head set) in cognos - database

I have a question regarding COGNOS inbuilt function.
I have a report of another developer in which he is using the inbuilt function total(currentMeausure within head set) in COGNOS. My task is to enhance the report. And the fields which have to be enhanced are using this function and I have no idea what this function is doing here.
Thanks,
Regards
Hajrah Naeem
I have searched a lot on google but didn't find accurate description about it. Can anyone explain me this function in easy way with some example so that I can continue my work?

Total is the aggregation to be done on the measure.
CurrentMeasure is either the defaultMeasure on the Crosstab or the Measure projected on an edge
Within set(head(dimension/level/set,N)) means the first N members of the defined object.
So for total(currentMeasure within set(head([ProductLine],3)) would give you total of the first 3 members in the ProductLine level.

Related

Convert FileTime to DateTime in Azure Logic App

I'm pretty new to Logic App so still learning my way around custom expressions. One thing I cannot seem to figure out is how to convert a FileTime value to a DateTime value.
FileTime value example: 133197984000000000
I don't have a desired output format as long as Logic App can understand that this is a DateTime value and can be able to run before/after date logic.
To achieve your requirement, I have converted the Windows file Time to Unix File Time then converted to File time by add them as seconds to a default date 1970-01-01T00:00:00Z. Here is the Official documentation that I followed. Below is the expression that worked for me.
addSeconds('1970-01-01T00:00:00Z', div(sub(133197984000000000,116444736000000000),10000000))
Results:
This isn't likely to float your boat but the Advanced Data Operations connector can do it for you.
The unfortunate piece of the puzzle is that (at this stage) it doesn't just work as is but be rest assured that this functionality is coming.
Meaning, you need to do some trickery if you want to use it to do what you want.
By this I mean, if you use the Xml to Json operation, you can use the built in functions that come with the conversion to do it for you.
This is an example of what I mean ...
You can see that I have constructed some XML that is then passed into the Data parameter. That XML contains your Windows file time value.
I have then setup the Map Object to then take that value and use the built in ado function FromWindowsFileTime to convert it to a date time value.
The Primary Loop at Element is the XPath query that will make the selection to return the relevant values to loop over.
The result is this ...
Disclaimer: I should point out, this is due to drop in preview sometime in the middle of Jan 2023.
They have another operation in development that will allow you to do this a lot easier but for now, this is your easier and cheapest option.
This kind of thing is also available in the Transform and Expert operations but that's the next tier level of pricing.

Alternative for a Nested Aggregate as a group filter SSRS

I have a report that needs to get only the top 10 of that category and sort it from highest value to lowest having this kind of expression:
=Sum(Sum(Fields!Measure.Value, "RowGroup1"), "RowGroup2")
But the problem is, the only filter that SSRS accepts is the simple aggregate:
=Sum(Fields!Measure.Value)
Not using the nested aggregate will give the wrong top 10.
Another thing, the client is using Analysis Services as the connection for the report so I cannot tweak the dataset by using a query. The fix should be inside SSRS. Is there anyway to do this? Please help me.
Please try using Top N filter from the chart properties. You might want to sort the values before using the filter.

a function calculate has been used in a true/false expression that is used as a table filter expression which is not allowed

I have a to check the current month and current year value for a measure in ssas tabular model but due to type mismatch i am not able to do this. For this, i have created a measure in which i am using this dax query
:CurrMonthYear:=CONCATENATE(CONCATENATE("""",concatenate(year(now()),CONCATENATE(0,month(now())))),"""") output: "201704"
...to calculate currentyear and currentmonth. But when i give this value in a measure like this:
SumOfRevisedForecast:=CALCULATE(SUM(DimRevisedForecast[RevisedForecast]),DimRevisedForecast[Approved] <>"N" && DimRevisedForecast[Approved] <>blank(),'DimRevisedForecast'[CalendarYearMonth] =CurrMonthYear)
...this doesnt work. Though, giving "201704" in place of CurrMonthYear works.
Can anybody help me in this?
Thanks in advance
The problem is not with CurrMonthYear measure, it's with your second formula - CALCULATE function does not accept measures as criteria, only values. That's why it works when you put "201704" explicitly but fails when you use the measure.
A common solution is to wrap the criteria into FILTER function, something like:
CALCULATE(SUM(DimRevisedForecast[RevisedForecast]),
FILTER ('DimRevisedForecast',
'DimRevisedForecast'[CalendarYearMonth] = [CurrMonthYear])
A great explanation of this issue is here:
FILTER() – When, Why, & How to Use It

Report Builder 3.0 Add Data Elements to an Array

I'm currently working on building a dashboard for some hospital metrics. The state requires that we report median key times. This dashboard will need to display the group median time for each day and the total column will need to display the entire dataset's median.
I'm working with Report Builder 3.0 and SQL Server 2014.
I've built a stored procedure that can calculate all these values accurately but accomplishing the mean this way makes expanding the dataset a bit of a monster when a new field needs to be pulled in.
All the articles (like as this one) I've read for calculating median within Report Builder point to needing to display (or insert and hide) all the data from the dataset. This method seems really hacky to me and is going to make this dashboard an absolute monster to try to manage as it grows.
What I need to know is, is there any way to pass the group values to a custom code function? The report has to have access to the group values at some point or else it wouldn't be able to perform the built in aggregate functions (Sum, First, Last, etc) on these groups. If I can't pass these values as an array to a custom code function, does anybody know how the group aggregate functions are built?
Thanks in advance to any who might have a direction to point me.
You can pass the values from the procedure to a function within SSRS and then have it just display the resulting median. I'll just give you summary to get you started.
Create a hidden parameter that allows multiple values.
Set its available values to pull from the dataset that is populated by your stored procedure.
Also set its default value so that all values are selected by default.
Go to the Code section of the report properties to write your function.
The function will take the parameter as an argument like this Public Function MyFunc(ByVal p1 as object()) as Integer
In the function you can refer to p1.Length and an item in the array like so: p1(i)
In the report you can call the function in an expression like this: =Code.MyFunc(Parameters!p1.Value)
Hope this points you in the right direction.

Qlikview - Pivot Chart accumulation expression

I am pretty new to Qlikview and I need some help with pivot table, accumulation expression (hope this makes any sense) over time. I have tried to find solution here, but simply by copy pasting expressions doesn't work (trial and error didn't pay off so far). So I hope you can help me with my first app.
I have managed to setup bar chart and it works perfectly because I can check the full accumulation, but in pivot there is no such thing..
Here is the setup:
Dimension: Date
Expressions:
Created = count(if(Status='New',Id))
Resolved = count(if(Status='Resolved',Id))
Open = Created - Resolved
Here you will find sample data. This table was modified from original date in order to get "Event" list, where I can track when each ticket was created / resolved (thanks to the contributors from stack overflow). From my understanding this is a good practice.
In attached image you will see what I want to achieve, but it will probably cause issues with my totals. Right now, while Open is totaly broken, end total at the end of the pivot is calculated "Ok", but on each day its totally wrong. Can i have both? I would gladly give up on total sum of Open if I can get it to work daily.
I have personal edition so I am unable to open qlikview apps, so I would appreciate if you could show me how to do this in some detail.
If anyone had issues with pivot accumulation like i had, use this expression:
rangesum(before(count({}Id) - count({}Id),0, ColumnNo()))

Resources