Building bar graph from SCCM report - ssrs-2012

I want to make a graph in Report Builder using my SCCM script that will show files like "%.DOCX, %.PST, %.XLSX, etc." I know it must have something to do with editing the line "SF.FileName" and making it group those files together and listing them simply as the extension, I just don't know how it should look like, if it should be in group expression or filter? So it looks like the X axis will show the file types and the Y axis will show number of files. Here is my report script:
Select Distinct SYS.Netbios_Name0, SYS.Resource_Domain_OR_Workgr0, SF.FileName, SF.FileDescription, SF.FileVersion, SF.FileSize, SF.FileModifiedDate, SF.FilePath from fn_rbac_GS_SoftwareFile(#UserSIDs) SF LEFT JOIN fn_rbac_R_System(#UserSIDs) SYS on SF.ResourceID = SYS.ResourceID WHERE SYS.Netbios_Name0 Like #variable AND SF.FilePath Like 'E:\Home-Folders\%' Order by SF.FileName
Any help would be appreciated.
Thanks,
Jack

As you said, we need to get the X axis, Y axis first.
The following query can give you some inspiration:
SELECT
SUM(CASE WHEN FILENAME LIKE '%.EXE' THEN 1 ELSE 0 END) '%.exe',
SUM(CASE WHEN FILENAME LIKE '%.INI' THEN 1 ELSE 0 END) '%.ini'
FROM v_GS_SoftwareFile
Then you could refer to the tutorial to fill up the bar chart.
Tutorial: Add a Bar Chart to Your Report (Report Builder)

Related

PowerBI: Slicer to filter a table Only when more than 1 value is selected

I have a table with 5 categories and units displayed into 2 types, Actual and budget.
I want to filter this table. Only when 2 or more values are selected in the slicer. Something like this.
I though of adding a measure, but dont know how to work the if statement exactly.
Measure = IF(COUNTROWS(ALLSELECTED(Report[Shipment Group])) = 1, "Something which would not filter the units", SELECTEDVALUE(Report[Units], SUM(Report[Units])))
Not sure if this is correct approach.Would like to know if any other approach is possible. Any help would be helpful. Thank you in advance.
This is a bit of an odd request, but I think I have something that works.
First, you need to create a separate table for your slicer values (or else you can't control filtering how you want). You can hit the new table button and define it as follows:
Groups = VALUES(Report[Shipment Group])
Set your slicer to use Groups[Shipment Group] instead of Report[Shipment Group].
Define your new measure as follows:
Measure = IF(COUNTROWS(ALLSELECTED(Groups[Shipment Group])) = 1,
SUM(Report[Units]),
SUMX(FILTER(Report,
Report[Shipment Group] IN VALUES(Groups[Shipment Group])),
Report[Units]))
or equivalently
Measure = IF(COUNTROWS(ALLSELECTED(Groups[Shipment Group])) = 1,
SUM(Report[Units]),
CALCULATE(SUM(Report[Units]),
FILTER(Report,
Report[Shipment Group] IN VALUES(Groups[Shipment Group]))))
Note: Double check that Power BI has not automatically created a relationship between the Groups and Report tables. You don't want that.

Show Different category name in tooltip in spotfire bar chart

We have a requirement for showing ID in category axis and description of same ID in tooltip.
I have multiple columns in my data like value 1 ,value2,value 3 etc. value 1, value 2 are columns.
I am putting this on value axis as an expression like Sum([value 1]) as [AC 6076 ], Sum([Value 2]) as [AC 6078 ], etc. that is this will hardcoded as IDs in category axis
So my category axis is column names. that is <[Axis.Default.Names]> .
please see the attached picture. It's the description against a column not a row.
It would be an expression in tooltip which may be something like
First(Case when '${Axis.Y.DisplayName}'='AC 6076' then "description 1" when '${Axis.Y.DisplayName}'='AC 6078 ' then "description 2" else " Description 3" end )
This expression is not showing correct value. it wil always show "Descrition 3"
i want to show this IDs(column names in category axis) and a description for each of these column names in tooltip. please have a look at the picture attached.
Atatched picture
Thanks
First(CASE
WHEN '${Axis.Y.DisplayName}'='AC 6076' THEN "description 1"
WHEN '${Axis.Y.DisplayName}'='AC 6078 ' THEN "description 2"
ELSE " Description 3"
END)
this always evaluates to your ELSE condition because ${Axis.Y.DisplayName} will always be the full display name for the axis, not the individual columns (i.e., "AC 6076, AC 6078").
you will need to add your description text to your data somehow. this is a little convoluted and will require some tweaking on your end, but the principle is the same.
this is assuming your table is something like this:
key val1 val2
a 1 4
b 2 5
c 3 6
from the menu, select File..Add Data Tables...
click Add then select the data table powering your visualization from the From Current Analysis heading
expand the Transformations pane at the bottom of this dialog
choose a Pivot transform and click **Add...*
leave everything default except for Transfer columns..., where you should add only the columns you wish to sum (e.g., [value 1] and [value 2])
OPTIONALLY change the naming scheme to just %T
click OK
your table now looks like (ignoring optional steps):
Sum(val1) Sum(val2)
6 15
choose another transform, this time Unpivot, and click **Add...*
add all columns to Columns to transform
click OK
now you have:
Category Value
Sum(val1) 6
Sum(val2) 15
choose one last transform: Calculate new column and click **Add...*
enter your case statement that will determine the description and name the column "Description" or something
click OK
click OK
your final table will resemble:
Category Value Description
Sum(val1) 6 This is the sum of value 1
Sum(val2) 15 This is the sum of value 2
on your bar chart, the category axis expression should be Category and value should be Sum(Value) (assuming you didn't change the column names in step 9)
add a new line to the tooltip with an expression First([Description]), or whatever you named the new column in step 12
whew. it's a lot of steps but it works. the goal is to get the description data into it's own column so you can put it in the tooltip. since your data is aggregated and doesn't exist in its own column, this is the only way I can think of doing it.

How to represent distances between two coordinates

I have a simple DataSet with 2 different coordinates by record.
(dem_latitude & dem_longitude are one coordinate, html_latitude & html_longitude are the other coordinate)
My main purpose is to see how big are the distances between each couple of coordinates.
As an clarification I don't want to see the distance as a number but represented in the map with the 2 coordinates (that form a couple) easily recognisable.
Solutions I can image but I don't know how to develop:
I can see for each coordinate which is its partner, maybe through a line.
Events like clicking in one coordinate makes the partner coordinate to be highlighted.
Any suggestion of how to implement any of this solutions or any other suggestion to achieve my "main purpose"?
If the solution is using the WYSIWYG CartoDB editor better :)
CartoDB UI and CartoDB WYSIWYG are very good and intuitive but when working with a single geometry per row. I'm not an expert, but I think in this case you'll need to use your developer super-powers and:
1 - alter the table schema and add a new column distance
2 - run a simple query to update that column value based on the points information:
UPDATE <table_name> SET distance = (SELECT ST_Distance(
ST_GeographyFromText(
'SRID=4326;POINT(' || dem_longitude || ' ' || dem_latitude || ')'
),
ST_GeographyFromText(
'SRID=4326;POINT(' || html_longitude || ' ' || html_latitude || ')'
)
)
);
Remember you can run queries using the API, so it's easy to integrate this query in any callback that adds data to the table to keep it updated.
Inspired by the #blat's answer, and after dealing with a lot of weird errors with SRIDs codes and the_geom_webmercator vs the_geom, I got this solution:
select
st_transform(
st_makeline(
st_setsrid(st_makepoint(html_longitude,html_latitude), 4326),
st_setsrid(st_makepoint(dem_longitude,dem_latitude), 4326)
),
3857
) as the_geom_webmercator
from the_data_set
If you also want to show the initial and the end point you have to create extra layers for each coordinate couple and then do something like:
select
cartodb_id,
st_transform(
st_setsrid(st_makepoint(dem_longitude,dem_latitude), 4326),
3857
) as the_geom_webmercator
from the_data_set
The result looks like this:

How do I modify a SELECT query to force specific values to be returned for a column, without updating what's actually stored in the table?

I don't know if this is possible, but hopefully this is pretty simply to answer.
Lets say you have read only access to a database (Oracle 11g in this case). You are querying data into an Excel sheet. Part of the data I'm gathering is a panel_name. And I'm only concerned about the data when panel_id=1 OR panel_id=2 OR panel_id=3.
Now, the problem is that for the purposes of this particular query I want to treat panel_id 1 and 3 as if they were the same, not updating the DB, just in the report. So Instead of;
when panel_id=1 then panel_name="Panel 1"
when Panel_id=3 then panel_name="Panel 3"
I'd like override it so that;
when panel_id=1 then panel_name="Panel 1"
when panel_id=3 then panel_name="Panel 1"
I haven't found anything that would allow me to do this though. I'm open to other alternatives as well, but in the end I'd just like to have both of those panels be treated as if they were the same. The code looks something like this;
SELECT
requisitions.received_date AS "Received Date"
,panels.PANEL_NAME AS "Panel Name"
FROM requisitions
inner join panels ON requisitions.PANEL_ID = panels.PANEL_ID
WHERE (panels.PANEL_ID = 1 OR panels.PANEL_ID = 2 OR panels.PANEL_ID = 3)
ORDER BY requisitions.RECEIVED_DATE DESC
Do you just want to have a CASE statement in your query?
SELECT
requisitions.received_date AS "Received Date"
,(CASE WHEN panels.panel_id IN (1,3)
THEN 'Panel 1'
ELSE panels.PANEL_NAME
END) AS "Panel Name"
If that is not what you're asking, it would be very helpful to post some sample data and the expected output of your query.

VS 2010 reporting services grouping

I want to load the list of the groups as well as data into two separate datatables (or one, but I don't see that possible). Then I want to apply the grouping like this:
Groups
A
B
Bar
C
Car
Data
Ale
Beer
Bartender
Barry
Coal
Calm
Carbon
The final result after grouping should be like this.
*A
Ale
*B
*Bar
Bartender
Barry
Beer
*C
Calm
*Car
Carbon
Coal
I only have a grouping list, not the levels or anything else. And the items falling under the certain group are the ones that do start with the same letters as a group's name. The indentation is not a must. Hopefully my example clarifies what I need, but am not able to name thus I am unable to find anything similar on google.
The key things here are:
1. Grouping by a provided list of groups
2. There can be unlimited layers of grouping
Since every record has it's children, the query should also take a father for each record. Then there is a nice trick in advanced grouping tab. Choosing a father's column yields as many higher level groups as needed recursively. I learnt about that in http://blogs.microsoft.co.il/blogs/barbaro/archive/2008/12/01/creating-sum-for-a-group-with-recursion-in-ssrs.aspx
I suggest reporting from a query like this:
select gtop.category top_category,
gsub.category sub_category,
dtab.category data_category
from groupTable gtop
join groupTable gsub on gsub.category like gtop.category + '%'
left join dataTable dtab on dtab.category like gsub.category + '%'
where len(gtop.category) = 1 and
not exists
(select null
from groupTable gchk
where gsub.category = gtop.category and
gchk.category like gsub.category + '%' and
gchk.category <> gsub.category and
dtab.category like gchk.category + '%')
- with report groups on top_category and sub_category, and headings for both groups. You will probably want to hide the sub_category heading row when sub_category = top_category.

Resources