Dashboard Multi BAQS all requiring same parameter passing

Hi everyone.

I have a number of Queries which all are based on the same data but different filteration. Each query has a parameter setup for Year - so when a year is typed in, the calculated fields count using datepart for month and year to give the number of quality issues.

My problem as you probably understand is that the parameter is asking to be completed for every query, so at the moment it would require to be input 3 times for the user (I have more queries to add too).

I hope a publish subscribe scenario could work, but I’ve been reading posts which state they don’t work with parameter use. Can anyone help me achieve this ?

Many thanks

Carla

One thought, since your columns are all the same in your queries, is to create a union query out of the 3 and add an additional column called ‘record type’ (or something similar) to filter by. Then create one query in your dashboard with 3 tabs filtering on record type.

A second option, is to have the date hidden in all of the queries and have the first one respond to the parameter and have that one publish the year. The other two can subscribe to the year field in the first query.

Ross

1 Like

Show the parameter for the top query as a field in the BAQ Results. Then filter the other queries in the dashboard by that published field.

Hi Ross,

This sounds very interesting - I have never used a union query - can you explain how this could be put together please?

Thanks Jason, however the parameter is used in calculations within the baq to count records so I believe I cannot do it this way unfortunately

Hi Carla,

I have a simple example attached that you can look at that combines customers and suppliers with an added field for record type.

Union.baq (20.7 KB)

A union query is two tables on top of each other with the same number of fields and the same data types in each field. That is pretty much it. If you have complex queries, you will need to make sure the subquery list is ordered correctly so it knows how to process the union. UNION ALL will return all records from each union level and UNION will group the stack.

To start, create a top level query and design how you want. Then, create a subquery and make sure the column count and data types are the same and select your subquery union type.

image

Take a look at the example and let me know if you have other questions.

Ross

Thankyou Ross,

In the meantime I have using your idea of record type got my 3 queries into one like you suggested, but not requiring unions.

So thankyou very much for this.

I am however battling with division by zero error – im certain I need to check for nulls, but for the life of me cant get my code to compile

This is my calculation which works fine

cast(sum(QC102.Calculated_October)As Float)/cast(sum(SummAllJobsByMonth.Calculated_SumOctJobs)As Float)*100

until theres a null or zero, then I get a divide by zero error on run of baq.

Is this something you can help with?

image325026.png

image745634.png

image711792.png

image209680.png

image079666.png

image352190.jpg

Try this:
CASE WHEN cast(sum(ISNULL(SummAllJobsByMonth.Calculated_SumOctJobs,0)) As Float) <> 0 THEN
cast(sum(ISNULL(QC102.Calculated_October,0))As Float) / cast(sum(ISNULL(SummAllJobsByMonth.Calculated_SumOctJobs,0))As Float)*100
ELSE 0 END

The difference is that it checks for a zero before it divides and it converts null values to zero so the math keeps working.

Depending on your query, it might be better to some of the math elsewhere but this is a starting point.

Let me know if this works for you.

Thanks,
Ross

This worked perfectly thankyou. However I am now back to my original issue - Ive rolled 3 queries into one, and ive rolled another 3 queries into one. so both 2 new queries ill add to the dashboard but want to apply Year parameter only once:)

So perhaps your second solution would work here:
A second option, is to have the date hidden in all of the queries and have the first one respond to the parameter and have that one publish the year. The other two can subscribe to the year field in the first query

I wonder how to go about this?

Here is how my dashboard looks so far

The Year parameter required for both queries is then used in Each month to perform calculations

Hi Carla,

Right click on your first query, go to the publish tab and select your Year column. Inexact example below:

image

Click OK on your first query. Right-click on your second query, select the FILTER tab and map your second query year field to your published query field from the dropdown box. Another inexact example below:

Confirm that and test the dashboard.

I am assuming you have the date part all sorted out. If not, let me know.

Thanks,
Ross

1 Like

Hmmm thankyou- first question if I may – I do not have a year column – I have a date column (using a datepart function based on a parameter I enter on load)

I was thinking create a Year calculated field on each query and put DATEPART(YEAR,< yourdatefield >) in it. This will give you the dynamic year. Group, filter as you will.

In the dashboard, it will have one parameter in the tracker view. It looks like you are using a BAQ parameter, which should still work as long as you have a year field in the first query to publish to the subscribing queries.

The 2nd/3rd queries can filter on this published year column from the same query.

image

Publish the column in the first query:
image

Subscribe to the published column:
image

Ross

Thanks Ross- really appreciate your help – I’ll give this a go

The only way I’ve been able to accomplish your original idea was to deploy the dashboard and use the DynamicQueryAdapter to pull into a new DataView and display the other grids via customization.