# New to Qlik Sense

If you’re new to Qlik Sense, start with this Discussion Board and get up-to-speed quickly.

Announcements
Qlik Cloud Maintenance is scheduled between March 27-30. Visit Qlik Cloud Status page for more details.
cancel
Showing results for
Did you mean:
Contributor II

## Calculation in Set Analysis per week

Hi all,

I have an Expression counting the amount of Order ID, where each segment ID has an Occupancy at 0%.

It works great when I filter on one specific week, but when I for example choose two weeks, I need the formula to perform the calculation on each week on each segment ID, and not only if Segment ID is zero on both weeks. Any suggestions on how to make this Calculation inside a set Analysis per week, and not just on total for all weeks?

------------------------------------------------------------------------------------------------------------------------------

Count({<Year={\$(=Max(Year))},[Group1],[ Group2]={"AB"},

[Segment ID] = {'=

If(

(1-((sum({<[Group1],[ID]={3},[Group2]={"AB"}>} [Sold])

/

(Sum({<[Group1],[Group2]={"AB"}>}[Capacity])-

Sum({<[Group1],[Group2]={"AB"}>}[Block])))))

=1,

(1-((sum({<[Group1],[ID]={3},[Group2]={"AB"}>} [Sold])

/

(Sum({<[Group1],[Group2]={"AB"}>}[Capacity])-

Sum({<[Group1],[Group2]={"AB"}>}[Block])))))

=1)

'}

>} [Order ID])

Labels (3)

• ### Set Analysis

2 Replies

Would you be able to share sample with expected output?

Contributor II
Author

No sorry, But I have simplyfied the formula:

Count({<Year={\$(=Max(Year))},[Group1],[ Group2]={"AB"},

[Segment ID] = {'=

If(

(1-((sum({<[Group1],[ID]={3},[Group2]={"AB"}>} [Sold])

/

(Sum({<[Group1],[Group2]={"AB"}>}[Capacity])-

Sum({<[Group1],[Group2]={"AB"}>}[Block])))))

=1)

'}

>} [Order ID])

Tags
Community Browser