Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I want to calculate the "Population" of a "Country" at "minimum Year".
PFA - screenshot suggest the min year is 1960. So, I want to calculate sum of population at 1960 of a country. please note that country is selected from a list box.
I am using this expression and it is not working:
=sum({<YearPopulation={"=(min(num#(YearPopulation)))"}>}Population)
But when I put =(min(num#(YearPopulation))) in a text box it returns 1960. I am not sure what I am doing wrong in Set Analysis expression. Can you please help?
Try
=sum({<YearPopulation={'$(=(min(num#(YearPopulation))))'}>}Population)
i.e. a dollar sign expansion to evaluate the min() function.
It would also be good to transform the YearPopulation field from text to number in the script.
can you share a sample and what is the expected output?
try
sum({$ <YearPopulation={$(=min(YearPopulation))}>} Population)
Try
=sum({<YearPopulation={'$(=(min(num#(YearPopulation))))'}>}Population)
i.e. a dollar sign expansion to evaluate the min() function.
It would also be good to transform the YearPopulation field from text to number in the script.
Give a try on the below expression:
=sum({<YearPopulation={"$(=min(num#(YearPopulation)))"}>}Population)
It seems that your YearPopulation is read as text and not Year field. I would suggest converting it to Year in the script like this:
LOAD Year(Date#(YearPopulation, 'YYYY')) as YearPopulation
and then you can try this:
=Sum({<YearPopulation={"$(=Min(YearPopulation))"}>} Population)
In case making modification in the script isn't possible, you can try MinString which will find the Min of Text String:
=Sum({<YearPopulation={"$(=MinString(YearPopulation))"}>} Population)
Thank you so much!