Skip to main content
Announcements
Introducing a new Enhanced File Management feature in Qlik Cloud! GET THE DETAILS!
cancel
Showing results for 
Search instead for 
Did you mean: 
annanirvin
Contributor III
Contributor III

Set analysis - calculation with dates

Hi all.

Can someone please help me with this calculation?

 

=Num(NumericCount (DISTINCT {1<Ä_slag={'AEF'}, Substatus={'Inkomna'}, Datum={"$(=Date(Max(Datum),'YYYY-MM-DD'))"}>}Ärendeid) / Sum({<Datum={"$(=Date(Max(Datum),'YYYY-MM-DD'))"}>}P_AEF), '# ###%')

 

NumericCount (DISTINCT {1<Ä_slag={'AEF'}, Substatus={'Inkomna'}, Datum={"$(=Date(Max(Datum),'YYYY-MM-DD'))"}>}Ärendeid) gives the correct answer as well as Sum({<Datum={"$(=Date(Max(Datum),'YYYY-MM-DD'))"}>}P_AEF) but not when I combine them. I suppose the problem has to do with the Datum={"$(=Date(Max(Datum),'YYYY-MM-DD'))"?

 

Best regards,

Anna

11 Replies
sunny_talwar

Where are you using this? Text box or a chart? What do you get individually and what do you get when you combine them?

sasiparupudi1
Master III
Master III

If you remove Num function, do you get the desired results?

annanirvin
Contributor III
Contributor III
Author

I use it as text in chart in a gauge chart.

NumericCount (DISTINCT {1<Ä_slag={'AEF'}, Substatus={'Inkomna'}, Datum={"$(=Date(Max(Datum),'YYYY-MM-DD'))"}>}Ärendeid) gives '1' and Sum({<Datum={"$(=Date(Max(Datum),'YYYY-MM-DD'))"}>}P_AEF) gives '4' when used individually and the result should be 25%, but as you can see in the right chart above it gives 26,49%. Any idé of why and how to solve this?

annanirvin
Contributor III
Contributor III
Author

No, it doesn´t work.

Anil_Babu_Samineni

Would you share sample to look

NumericCount (DISTINCT {1<Ä_slag={'AEF'}, Substatus={'Inkomna'}, Datum={"$(=Date(Max(Datum),'YYYY-MM-DD'))"}>}Ärendeid)


This will return only numeric numbers of Ärendeid where Filters are applying with Constant value like even if your selection is happening on filter pane it won't react.


I didn't known if there is any error on this. Seems ok to me


Sum({<Datum={"$(=Date(Max(Datum),'YYYY-MM-DD'))"}>}P_AEF)


This is also works for you, Try like below


Num(NumericCount (DISTINCT {1<Ä_slag={'AEF'}, Substatus={'Inkomna'}, Datum={"$(=Date(Max(Datum),'YYYY-MM-DD'))"}>}Ärendeid)/Sum({<Datum={"$(=Date(Max(Datum),'YYYY-MM-DD'))"}>}P_AEF),'#,#0%')


Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
annanirvin
Contributor III
Contributor III
Author

Unfortunately I can´t share since my work is confidential.

Thank you, but your solution gives 26,50%. Still not right that is.

Anil_Babu_Samineni

I've tried this?

=Num(1/4,'#,#0%') -- It is giving 25% in KPI. Can you check from your end

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
sasiparupudi1
Master III
Master III

I think there may be a rounding issue here.. your sum might be returning 3.77 andhence you see 26%..

annanirvin
Contributor III
Contributor III
Author

That´s right but for some reason I doesn´t seem to get '1' and '4' in my combined calculation, only when I use them individually.