Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
seWork
Contributor III
Contributor III

count if set analysis greater than in straight table

Hi all,

I'm trying to count what is the frequency of the line value per item (Avg. and 98% of the lines)

My expectation is :

Item days soldOrdersLinesLine valueAvg. Line valueFrequency(Count - Line value above avg.)  98% lines value Frequency(Count - Line value above 98%) 
11342973069363.0645373
2218286030946310.2174453
3216202422064580.21704.5443
411674675423633.141392011

I tried to use

Count({<Line_Value={">=$(Fractile(aggr(Sum({<Line_Type={1,2}>} Line_Value),[Order Number]),0.98))"}>} DISTINCT [Order Number])

but the function calculates the "Fractile(aggr(Sum({<Line_Type={1,2}>} Line_Value),[Order Number]),0.98)" as 0

so i'm getting the counting of all of the [Order Number]


but when I'm using similar calculation for the average I'm getting the correct answer

Count({<Line_Value= {">=$(=(Sum({<Line_Type={1,2}>} Line_Value)/COUNT([Order Number])))"}>} DISTINCT [Order Number])

what is the problem and how could I fix it?

1 Reply
Gysbert_Wassenaar

The problem is that the set is calculated at the chart level, but the dollar expansion with your fractile function is using the dimension values of the rows. That means that it can't return anything other than 0 at the chart level, where there are no row level dimension values. By putting an = character inside the dollar expansion the expression will be calculated at the document level and can return a result. Your second expression does include the = character inside the dollar expansion and that does give a result. So try: Count({<Line_Value={">=$(=Fractile(aggr(Sum({<Line_Type={1,2}>} Line_Value),[Order Number]),0.98))"}>} DISTINCT [Order Number])


talk is cheap, supply exceeds demand