Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Manmeet
Contributor III
Contributor III

Calculating Gender ratio

Manmeet_1-1661232244249.png

 

Hi All,

I am trying to calculate gender ratio here for the Male and female Icons as shown in the Image, The only condition is that by default it should show FY 2021-22 "March" data and it should change dynamically based on the Year, month, quarter selections.

Below is the current script which is being used to calculate only for March 2021-22 , Let me know what changes i need to do in the current script order to get the desired output.

 


Count({$<[Fiscal Month]={'Mar'},Gender={'M'},FiscalYear={'2021-22'}>}distinct [PS No])-Count({$<[Fiscal Month]={'Mar'},Gender={'M'},FiscalYear={'2021-22'},EXT_Flag={'External'}>}distinct [PS No]))
/(Count({$<[Fiscal Month]={'Mar'},FiscalYear={'2021-22'}>}distinct [PS No])-Count({$<[Fiscal Month]={'Mar'},FiscalYear={'2021-22'},EXT_Flag={'External'}>}distinct [PS No]))


Thanks & regards,

Manmeet Dhawan

2 Replies
Mark_Little
Luminary
Luminary

HI @Manmeet 

At a glance that should give you default results, you would need to then wrap an if around it to remove the set express for Fiscal year and month if a selections is made something like.

IF(GetSelectedCount([Fiscal Month]) > 0 AND GetSelectedCount([Fiscal Year])  > 0, 

Count({$<,Gender={'M'},>}distinct [PS No])-Count({$<,Gender={'M'},EXT_Flag={'External'}>}distinct [PS No]))
/(Count({$<>}distinct [PS No])-Count({$<EXT_Flag={'External'}>}distinct [PS No])),

Count({$<[Fiscal Month]={'Mar'},Gender={'M'},FiscalYear={'2021-22'}>}distinct [PS No])-Count({$<[Fiscal Month]={'Mar'},Gender={'M'},FiscalYear={'2021-22'},EXT_Flag={'External'}>}distinct [PS No]))
/(Count({$<[Fiscal Month]={'Mar'},FiscalYear={'2021-22'}>}distinct [PS No])-Count({$<[Fiscal Month]={'Mar'},FiscalYear={'2021-22'},EXT_Flag={'External'}>}distinct [PS No]))

)

Manmeet
Contributor III
Contributor III
Author

Hi Thanks for your suggestion , should i use the same script or do i need to modify something in it?
Because i used the same script and it isn't giving any output.

Please check

Manmeet_0-1661255494457.png