I have two tablix in ssrs report.I am using the same dataset for first tablix which shows details second shows - ssrs-tablix

There are two tablix in ssrs report. I am using the same dataset for both tablix. First tablix which shows JOB details and $amnt BY Date (5 month worth of data) and second tablix shows records Grouped by Job and total of $amonts from tablix1.
Tablix 2 shows correct $Sum but for some records there are duplicate rows- if Tablix#1 has more than 1 $amnt.
Example Tablix1: ProjectABC - 1/1/2019 =$2 ; 1/5/2019=$5
ProjectHTG -1/1/2019 =$3
Exampl Tablix2: ProjectABC -$7
ProjectABC -$7
ProjectHTG -$3
how do i modify my expression "=sum(Fields!units.Value,"project2")"
to print "ProjectABC -$7" as one line?

Assuming that your field name if JOB for the project, you would add the field along with the dash to your current expression.
You should NOT group by amount if you want to SUM the amount. You are getting a separate line for each different amount for the same JOB. Only JOBs with the same amounts will be SUMmed as one.
=Fields!JOB.Value & " - " & sum(Fields!units.Value)
A few other issues:
Why are you using the Dataset name in your SUM? It sounds like you have a simple table that groups by JOB and Amount. The table is associated to the Dataset that you want to use. You should only use the dataset name in a table when you're referring to a different dataset than the table is using.
Why do you need two datasets if they have the same info? The second table can do the grouping and summing (and already is) from the same dataset as the first table.

Related

PowerBI groupby with filters

My company has tasked with slicing the information on turnover and to create different graphs.
My source data looks like this: Relevant columns are: Voluntary/Involuntary, Termination Reason, Country, Production, and TermDateKey
I am trying to get counts using different filters on the data. I managed to get the basic monthly total using the formula:
Term Month Count = GROUPBY('Turnover Source','Turnover Source'[TermDateKey],"Turnover Total Count", COUNTX(CURRENTGROUP(),'Turnover Source'[TermDateKey]))
This gave me a new sheet with the counts for each month.
Table that shows TermDateKey on Column 1, and Counts on column 2
I am trying to add onto this table by adding counts but using different filters.
For example, I am trying to add another column that gives me the monthly count but filtered for 'Turnover Source'[Voluntary/Involuntary]=="Voluntary". Then another column for 'Turnover Source'[Voluntary/Involuntary]=="Involuntary" and so on. I have not found anywhere that shows me how to do this and when I add in the FILTER function it says that GROUPBY(...) can only work on CURRENTGROUP().
Can some one point me to a resource that will give me the solution I need? I am at a loss, thank you all.
It looks like you may not be aware that you don't have to calculate all possible groupings with DAX formulas.
The very nature of Power BI is that you use a column like "Termination Reason" on an X axis or in the legend of a visual. Any measure that you have created on values of another column, for e.g. a count of all rows, will then automatically be calculated to be grouped by the values in "Termination Reason", giving you a count of each of the values in the column.
You do NOT need DAX functions to calculate the grouping values for each measure for each column value combination.
Here is some simple sample data that has been grouped into dates and colours, one chart showing a count of each colour and one chart showing a sum of the Value column. No DAX was written for that.
If your scenario is different, please explain.

Oracle Reports (6i): Get difference of two items from two different queries (Multi Query Report)

I have an Oracle 6i report with Two Complex Queries (Q1 and Q2) connected by Data Link. The report was developed by some other developer who is not available now. Multiple columns are being displayed in report.
Q1 has a column Total_Issuance and Q2 has a column Total_Consumption. I have to display their difference on report. I am using a formula column to get the difference and then binding a display field to this formula column to show on report.
But since the formula column is outside both the queries, I am getting following errors.
REP-1517: Coloumn 'CF_1' references column 'Total_Issuance', which has incompatible frequency.
REP-1517: Coloumn 'CF_1' references column 'Total_Consumption', which has incompatible frequency.
Just like the formula column is outside both queries, create two additional summary columns (outside of both queries):
cs_tot_iss, which will sum total_issuance
cs_tot_con, which will sum total_consumption
Now modify formula column so that its source are newly created summary columns, e.g. let it
return :cs_tot_iss + :cs_tot_con;
As of paper layout: you don't have to display cs_tot_iss nor cs_tot_con (as you already have those values via total_issuance and total_consumption), just add formula column.
Create a new calculated field to the query that is the detail query (I asume it's Q2).
In this calculated field you can simply use:
return :Total_Issuance - :Total_Consumption;
to calculate the difference.

Report Builder - Datediff between 2 columns

I have created a report with Report Builder 3.0 using columns groups.
The columns retrieve a datetime field. I would like to calculate the date difference between two columns.
For each individual the report should display 1 row and 2 columns. One of the columns can have null values. In this case, no calculation needs to be performed.
I cannot perform any calculation at the dataset level because I am using a stored procedure that I cannot modify.
I have tried to perform a calculation but the values are not correct. Moreover, the results are also changing if the Sort values change.
Random sort
Basically, I need to calculate the different between the 2 columns at the row level.
Any ideas?
Desired Output

SSRS Unmerge Matrix Columns

I have a matrix report with 9 Row Groups and 1 Column Group (Months).
Instead of showing duplicate rows on the row groups, SSRS and Excel merge those fields. I would like them unmerged! I would like them to duplicate on my report.
I tried going to the parent group and grouping by every other field. This worked until I added two rows within the group, (which I need).
I guess you could also say that I really want my row groups to look like a table. If there's a better way to do that, I'm all ears!
enter image description here
Is it TYPE field that you need all the lines for?
The bracket to the left (under Row Groups) indicates that you are Grouping on something. Remove the Group Only (but not the rows and columns) so you are not grouping and all lines will be displayed.

How can I get the values in the Matrix on my SSRS report to repeat?

I know there must be a simple answer to this, but I can't find it.
I have added a couple of textboxes to a Matrix in a BIDS/SSRS report. I've given these textboxes values such as:
=Fields!WEEK1USAGE.Value
It works (after a fashion); when I run the report (either on the Preview tab, or on the Report Server site) I see the first corresponding data value on the report - but only one.
I would think that once a value has been assigned via expressions such as "=Fields!WEEK1USAGE.Value", each value would display (rows would automatically be added).
There must be some property on the Matrix or the textbox that specified this, but I can't see what it might be.
Here is how my report looks (very minimalistic, so far) in the Layout pane:
...and after running, on the Preview tab:
Obviously, I want the report to display as many rows as necessary, not just one. The textboxes do have a "RepeatWith" property, but there description doesn't sound interesting/useful/promising.
I don't see any property on the Matrix control that looks right, either.
I thought maybe the designer was only showing one row of values, and ran the report on the server, too, but there also it just shows the two values.
So what do I need to do to get all the data for a provided field?
Matrices are for display of grouped data and summary information, usually in a horizontally expanding pivot table type of format. Is a matrix really what you are after? Looking at your expression you have =Fields!Week1Usage.Value but in a matrix what I expect to see would be at least =Sum(Fields!Week1Usage.Value) or even better just =Sum(Fields!Usage.Value). Then you would have ProactDescription as your row group and the week as your column group and it would all just work out everything for you, grouping and summing by Proact vertically and expanding the weeks out horizontally.
What seems to be happening is that you have no grouping on rows or columns and no aggregation so it is falling back to the default display which is effectively the First function - it displays the first row of data and as far as the matrix is concerned it has done its job because there is no grouping.
Without knowing your problem or data, I'll make up a scenario that might be what you are doing and discuss how the matrix does the heavy lifting to solve that problem. Let's say you have usage data for multiple Proacts. Each time one is used you record the usage amount and the date and time it is used. It could be used multiple times per day but certainly multiple times in a week. So you might be able to get the times each Proact is used from a table like so:
SELECT ProactDescription, TimeUsed, Usage
FROM ProactUsage
ORDER BY ProactDescription, TimeUsed
In your report you want to show the total weekly usage for each Proact over multiple weeks. Something like this:
Proact Week1 Week2 Week3 ...
Description Usage Usage Usage ...
--------------------------------------------
Anise, Fennel 1 CT 20.00 22.50 16.35 ...
St John's Wort 15.20 33.90 28.25 ...
...
and so on. Using a dataset based on the SQL above we create a matrix and in the row group properties we group on =Fields!ProactDescription.Value and in the column group properties we group on a week expression like =DateDiff(DateInterval.Week, Fields!TimeUsed.Value, Today) and then in the intersection of the row and column we put =Sum(Fields!Usage.Value). To display the header of the column nicely put an expression like
="Week " & DateDiff(DateInterval.Week, Fields!TimeUsed.Value, Today)
The matrix automatically does all the summing by week and product and expands the weeks horizontally for as many as you are reporting. For bonus points you can also put totaling at the end of the columns and the rows to show the total use of that Proact for the period (row total) and total use of all Proacts in that week (column total).

Resources