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

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Noctis
Contributor III
Contributor III

Create a Bellcurve in a yearmonth Table with a inputvariable

Is it possible to distribute a given value like  50.000, across a range of yearmonths (sorted in ascending order), following a bell curve distribution, directly in the frontend in a table?

example


load * Inline
[
year_Calendarmonth

202401

202402

202403

202404

202405

202406

]
;

vTestinput = 50000;

Labels (3)
2 Solutions

Accepted Solutions
JandreKillianRIC
Partner Ambassador
Partner Ambassador

Yes and no. There is a whole part of math behind a bell curve. Currently we are using the values in the year_CalendarMonth field. This is used in the math, Hence the reason when you added the other value this does not represent a bell curve anymore. 

 

Distribution of 1 I would just normalize the data using the variable = 1 and not 50000. I am looking into this to add "random" values and getting a perfect result.

Mark the solution as accepted that solved your problem and if you found it useful, press the like button! Check out my YouTube Channel | Follow me on LinkedIn

View solution in original post

JandreKillianRIC
Partner Ambassador
Partner Ambassador

Hi @Noctis 

We need to assign a value (In terms of the number size) to the value. This will ensure that the value always changes on selection and is not influenced by something like 200001 vs 208811. Below is my inline load 

JandreKillianRIC_1-1737399914855.png

Expression

Only(NormDist(Aggr(Rank(year_CalendarmonthID), year_CalendarmonthID), Avg(Total Aggr(Rank(year_CalendarmonthID), year_CalendarmonthID)), 
Stdev(Total Aggr(Rank(year_CalendarmonthID), year_CalendarmonthID)), 0)) 
* 0.1 
* Count(Total year_CalendarmonthID) 
* (50000 / Sum(Total Aggr(Only(NormDist(Aggr(Rank(year_CalendarmonthID), year_CalendarmonthID), Avg(Total Aggr(Rank(year_CalendarmonthID), year_CalendarmonthID)), 
Stdev(Total Aggr(Rank(year_CalendarmonthID), year_CalendarmonthID)), 0)) * 0.1 * 
Count(Total year_CalendarmonthID), year_CalendarmonthID)))

 

My result 

JandreKillianRIC_2-1737399953552.png

 

Regards - Jandre

 

 

Mark the solution as accepted that solved your problem and if you found it useful, press the like button! Check out my YouTube Channel | Follow me on LinkedIn

View solution in original post

9 Replies
JandreKillianRIC
Partner Ambassador
Partner Ambassador

Hi @Noctis 

You can Create a Line Chart with Dimension "year_Calendarmonth"

Expression would be this. 

Only(NormDist(year_Calendarmonth, Avg(Total year_Calendarmonth), Stdev(Total year_Calendarmonth), 0)) * 0.1 * Count(Total year_Calendarmonth)

And then using the input variable would be this 

Only(NormDist(year_Calendarmonth, Avg(Total year_Calendarmonth), Stdev(Total year_Calendarmonth), 0)) * 0.1 * $(vTestinput)

Mark the solution as accepted that solved your problem and if you found it useful, press the like button! Check out my YouTube Channel | Follow me on LinkedIn

Noctis
Contributor III
Contributor III
Author

Thanks Jandre, but I need this as a Table. do you have a solution for that too?

JandreKillianRIC
Partner Ambassador
Partner Ambassador

Hi @Noctis 

Not at my pc now, but have you tried building the LineChart? Maybe just try and convert to table? 

Let me know. 

Mark the solution as accepted that solved your problem and if you found it useful, press the like button! Check out my YouTube Channel | Follow me on LinkedIn

Noctis
Contributor III
Contributor III
Author

Noctis_0-1737389166951.png


it goes in the right direction but it does not fully distribute the whole 50000

JandreKillianRIC
Partner Ambassador
Partner Ambassador

Hi @Noctis 
Just change the 50000 to the variable that you are using. 

Only(NormDist(year_Calendarmonth, Avg(Total year_Calendarmonth), Stdev(Total year_Calendarmonth), 0)) * 0.1 * Count(Total year_Calendarmonth)
* (50000 / Sum(Total Aggr(Only(NormDist(year_Calendarmonth, Avg(Total year_Calendarmonth), Stdev(Total year_Calendarmonth), 0)) * 0.1 * Count(Total year_Calendarmonth), year_Calendarmonth)))

Mark the solution as accepted that solved your problem and if you found it useful, press the like button! Check out my YouTube Channel | Follow me on LinkedIn

Noctis
Contributor III
Contributor III
Author

Noctis_0-1737397563403.png

I added 202352 and Now its not a Bellcurve anymore. Do you have another solution?

Noctis
Contributor III
Contributor III
Author

Noctis_0-1737398284175.png

 

Additionally I am looking for a total distribution of 1. Only in this case would it represent a perfect bell curve, correct?

JandreKillianRIC
Partner Ambassador
Partner Ambassador

Yes and no. There is a whole part of math behind a bell curve. Currently we are using the values in the year_CalendarMonth field. This is used in the math, Hence the reason when you added the other value this does not represent a bell curve anymore. 

 

Distribution of 1 I would just normalize the data using the variable = 1 and not 50000. I am looking into this to add "random" values and getting a perfect result.

Mark the solution as accepted that solved your problem and if you found it useful, press the like button! Check out my YouTube Channel | Follow me on LinkedIn

JandreKillianRIC
Partner Ambassador
Partner Ambassador

Hi @Noctis 

We need to assign a value (In terms of the number size) to the value. This will ensure that the value always changes on selection and is not influenced by something like 200001 vs 208811. Below is my inline load 

JandreKillianRIC_1-1737399914855.png

Expression

Only(NormDist(Aggr(Rank(year_CalendarmonthID), year_CalendarmonthID), Avg(Total Aggr(Rank(year_CalendarmonthID), year_CalendarmonthID)), 
Stdev(Total Aggr(Rank(year_CalendarmonthID), year_CalendarmonthID)), 0)) 
* 0.1 
* Count(Total year_CalendarmonthID) 
* (50000 / Sum(Total Aggr(Only(NormDist(Aggr(Rank(year_CalendarmonthID), year_CalendarmonthID), Avg(Total Aggr(Rank(year_CalendarmonthID), year_CalendarmonthID)), 
Stdev(Total Aggr(Rank(year_CalendarmonthID), year_CalendarmonthID)), 0)) * 0.1 * 
Count(Total year_CalendarmonthID), year_CalendarmonthID)))

 

My result 

JandreKillianRIC_2-1737399953552.png

 

Regards - Jandre

 

 

Mark the solution as accepted that solved your problem and if you found it useful, press the like button! Check out my YouTube Channel | Follow me on LinkedIn