Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi Friends,
I have a requirement to show minimum month data by customer. I tried set analysis to do this but its not working as expected. Could anyone please help me on this issue.
I greatly appreciate your help in advance
My original data set is
Cust ID | MonthYear | Quantity |
112 | Feb-12 | 10 |
111 | Mar-12 | 10 |
114 | Apr-12 | 10 |
117 | Mar-12 | 10 |
111 | Apr-12 | 20 |
112 | Apr-12 | 20 |
121 | Jan-12 | 10 |
Correct Output
Cust ID | Minimum Month | Month Quantity |
112 | Feb-12 | 10 |
111 | Mar-12 | 10 |
114 | Apr-12 | 10 |
117 | Mar-12 | 10 |
121 | Jan-12 | 10 |
Set analysis i used to restrict the min month in expression is
sum
({<MonthYear={'$(=MinString(MonthYear))'}>}Quantity
)
output i am getting is
CustID | Min Month | Min Month Quantity |
Apr-12 | 50 | |
111 | Apr-12 | 20 |
112 | Apr-12 | 20 |
114 | Apr-12 | 10 |
117 | Mar-12 | 0 |
121 | Jan-12 | 0 |
I have attached my qvw file as well.
Hard to say what you want to do here, you'll need at least to post your variable definitions, too. At best, post a small sample file that demonstrate your issue.
One thing I already noticed, you are using an aggregation function inside another aggregation function (sum() inside FirstSortedValue() ). This is not allowed without using advanced aggregation (aggr() function).
Not sure if you need to use sum() at all, you could potentially just use a set expression with the FirstSortedValue() function.
Thanks you, i made it work using firstsortedvalue function. But the function is returning null when there are multiple records for specific month. How can i avoid this null and group to monthly level in frontend?
Please look at the attached example. I have added extra records to customer 112 and spitted feb-12 quantity into multiple dates. In front end its showing null for customer 112. Is there any way to show the proper total(10) for feb-12 without grouping data at monthly level?
Try something like
=FirstSortedValue(aggr(sum(Quantity),CustID,Monthstart),aggr(Monthstart,CustID,Monthstart))