Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
See why IDC MarketScape names Qlik a 2025 Leader! Read more
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Set analysis on monthstart, possible - syntax?

Hi

I need some help to understand if what I try to achieve is possible or not and your help is much obliged.

I have to date fields  table1.dateA and table2.dateB and one field to count (in the fact table)

COUNT({<monthstart(dateA)= {(=MonthStart(dateB))} >} DISTINCT field_to_count)

Is it possible to only DISTINCT COUNT where MonthStart(table1.dateA) = MonthStart(table2.dateB)?

If yes would you be so kind and advice on the syntax?

Thank you

6 Replies
sunny_talwar

May be this:

Count({<field_to_count = {"=monthstart(dateA) = MonthStart(dateB)"}>} DISTINCT field_to_count)

Not applicable
Author

Thank you for the suggestion but this did not work.. I'm stil trying..

sunny_talwar

Would you be able to share a sample where this isn't working?

vishsaggi
Champion III
Champion III

What are your date formats for your dateA and dateB?

Not applicable
Author

Hi

My dateA format is 2015-10-01 00:00:00

I try to simplify to see if this is possible but Im not able to make this work either:

count({$<dateA={date#('2015-10-01','YYYY-MM-DD')}>} DISTINCT field to count)

I try to filter out only the rows where dateA = 01OCT2015 using a set expression.

Maybe Im trying to do something that cant be done?

I came across this:

Limitation: take care, a set analysis is calculated once per chart (or table). NOT once per row. If you

want a different result in your set analysis according to the row being calculated and displayed, it will NOT

work. Change the way to compute your data (model, if statement) but forget the set analysis.

vishsaggi
Champion III
Champion III

Is your Field to count is actual field name here? Try this? Using sunny's expression

count({$< fieldtocount ={ "= MonthStart(Date(date#(dateA,'YYYY-MM-DD hh:mm:ss') 'YYYY-MM-DD')) = MonthStart(Date(date#(dateB,'YYYY-MM-DD hh:mm:ss') 'YYYY-MM-DD')) " }>} DISTINCT field to count)