Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

July 28 - August 9 | Final Round of the Power BI Dataviz World Championships. This is your chance. Learn more

Reply
Anonymous
Not applicable

Wonderware INSQL Historian

i am using wonderware historian which based on INSQL(industrial SQL ) bewlow query to retrive certain tag ('mesCANFiller02.stOperatingState')

i have to specifiy startdata and Enddata in my query as fixed value to let this query work .

My question . how can i make this query dynmaic means link this query with slicer. 

 

 

SET NOCOUNT ON
DECLARE @StartDate DateTime
DECLARE @EndDate DateTime
SET @StartDate = DateAdd(hh,-24,GetDate())
SET @EndDate = GetDate()
SET NOCOUNT OFF
SELECT  * FROM (
SELECT History.TagName, DateTime, Value, vValue, StartDateTime
FROM History
WHERE History.TagName IN ('mesCANFiller02.stOperatingState')
AND wwRetrievalMode = 'Delta'
AND wwQualityRule = 'Extended'
AND wwVersion = 'Latest'
AND DateTime >= @StartDate
AND DateTime <= @EndDate) temp WHERE temp.StartDateTime >= @StartDate
ORDER BY DateTime DESC

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

HI @Anonymous,

 

It is impossible to send slicer selection data to query editor as filter parameter.

 

Date levels:

Database -> Power query(query table, query parameter, custom function) -> Data model(calculated column/table, RLS) -> Data view(measure, visual , slicer)

 

Notice: Parent level can affect child but child is impossible to affect its parent.

 

For your scenario, you can only use query parameter to get dynamic result table.

Deep Dive into Query Parameters and Power BI Templates

 

Regards,

Xiaoxin Sheng

View solution in original post

2 REPLIES 2
neil_varnas_IP
Advocate I
Advocate I

Hi @Anonymous ,

 

This is a late reply but there is a quicker and more user friendly to conenct to Wonderware historians (and many, many more). Check this blog post in Power BI Community Blog.

Anonymous
Not applicable

HI @Anonymous,

 

It is impossible to send slicer selection data to query editor as filter parameter.

 

Date levels:

Database -> Power query(query table, query parameter, custom function) -> Data model(calculated column/table, RLS) -> Data view(measure, visual , slicer)

 

Notice: Parent level can affect child but child is impossible to affect its parent.

 

For your scenario, you can only use query parameter to get dynamic result table.

Deep Dive into Query Parameters and Power BI Templates

 

Regards,

Xiaoxin Sheng

Helpful resources

Announcements
Fabric Community Sticker Design Challenge Barcelona Carousel

Fabric Community Sticker Challenge - Barcelona 2026

If you love stickers, then you will definitely want to check out our community sticker challenge, Barcelona edition!

July Power BI Update Carousel

Power BI Monthly Update - July 2026

Check out the July 2026 Power BI update to learn about new features.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Top Solution Authors