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

Set Analysis Using 'Or' Condition and Distinct Count

I am working to create a percentage of total PO Lines based on two different flags.  If at least one of the Flag is equal to 'Y', I want to count that line.  The count is also dependent on a date variable for the current month and year.  When I conduct the below set analysis, the formula does not work.  I have tested the variable and know that it works.  I have used the same formula for a sum of total spend instead of a count and the formula worked.  Can anyone offer some support as to where I am going wrong or offer a different solution? Thank you so much!

Field set in script:

Date([PO Date],'MMM-YYYY') as MonthYear,


Variable:

vCurMonthYear=DATE(max([PO Date]),'MMM-YYYY')

Set Analysis:

count({$<[Cntrct Flg]={'Y'}, MonthYear={'$(=vCurMonthYear)'}>+<[Active]={'Y'}, MonthYear={'$(=vCurMonthYear)'}>}distinct[PO Line])/count({$<MonthYear={'$(=vCurMonthYear)'}>}distinct[PO Line])

Labels (1)
10 Replies
kristen_ludlow
Contributor
Contributor
Author

Yes, the total spend set analysis works.  I dont' think I will be able to share a sample.  It is possible there could be missing data for the PO Line.  If there are null values could that cause any issues?  The QlikSense version I am using is November 2017, do you think there could be possible bugs in the system?  I am giong to try to recreate the same App on Qlik Desktop to see if there could be any bugs with the eneterprise version.