23 Replies Latest reply: Jan 27, 2015 12:36 AM by aditya janapala

# Sorting in a bar chart

Hi All ,

i have a trend graph on a bar chart , were i am uploading 3 months of data . i would like to sort data on the basis of last uploaded month data.

for example : i am uploading data for october , november and decemeber . now i need to sort data on the basis of december data and i need to show respective november and october months data .

hope this information helps.

• ###### Re: Sorting in a bar chart

Sort by numeric value descending

• ###### Re: Sorting in a bar chart

i am not getting the right answer when i sort by numeric value . let me more clear .

i have two dimenions . product and month and expression is count of product . i am also following up with an example . i need my chart to display exactly like the one in below graph which i created in excel

 Oct Nov Dec A 55 10 60 C 12 22 45 B 15 20 30 D 80 10 20 E 20 100 10

• ###### Re: Sorting in a bar chart

PFA

Hope this helps

• ###### Re: Sorting in a bar chart

as far as i see , the qvw file which you sent . the sort is done on state = ascending order . but i dont see my data is sorting still on basis of highest last uploaded month(December highest number ).

please check the picture which i presented here

• ###### Re: Sorting in a bar chart

Make a variable to store the value of the latest month. lets say december. Then use this expression in sort by expression set to descending value for Product.

=Count({<Month field name= {"\$(Variable name"}>}Product)

• ###### Re: Sorting in a bar chart

i utkarsh i created a variable using vmonth= Month(AddMonths(Today(),-1))  and i am getting month has dec , but when i am giving in the expression i am not getting the right value

if i am right , i used that sorted expression in expression tab , if the expression i am using is right

=Count({<Month field name= {"\$(vmonth"}>}Product) , i should get only december month data right ?

please correct me if i am wrong

• ###### Re: Sorting in a bar chart

Count({<Month field name= {"\$(vmonth)"}>}Product)

You missed a bracket there (after vmonth)

• ###### Re: Sorting in a bar chart

my dimensions or

Month([terc_ClosingDate])

terc_DefectCategory

the expression i am using is

Count({<[Month([terc_ClosingDate]])]= {'\$(vmonth_current)"}>}[terc_DefectCategory]

still i dont find any change

• ###### Re: Sorting in a bar chart

Create Month([terc_ClosingDate] as a field in your script. This cannot be used directly in set analysis.

• ###### Re: Sorting in a bar chart

i have that field in the script , that is why i am able to sort values according to month wise .

• ###### Re: Sorting in a bar chart

Check this

• ###### Re: Sorting in a bar chart

hi vignesh , could you please  just give me the sorting expression or the logic . i dont have a licenced version

• ###### Re: Sorting in a bar chart

Dims:

1.product

2.month

Expr:

count

In Sorting tab:

1.For product dim sort by expression (Descending) and use this expression

"sum({<Month={\$(=minstring(Month))}>}Count)"

2.For month dim uncheck all

Thanks,

Vignesh

• ###### Re: Sorting in a bar chart

hi vignesh,

i am touch confused with minstring function

my dimensions or

Month([terc_ClosingDate])

terc_DefectCategory

sum({<[Month([terc_ClosingDate]])]={\$(=minstring(Month([terc_ClosingDate))}>}Coun[tterc_DefectCategory])"

is this the right script?

• ###### Re: Sorting in a bar chart

First Dim - terc_DefectCategory

Second Dim - Month([terc_ClosingDate])

Sorting Tab:

Sum({<Month([terc_ClosingDate])={\$(=minstring(Month([terc_ClosingDate])))}>}terc_DefectCategory)

• ###### Re: Sorting in a bar chart

Make Month([terc_ClosingDate]) as Month in Script.

Use Count({<Month= {"\$(vmonth"}>}Product) in sort expression

Don't use date function in set analysis directly. They don't work in set analysis.

• ###### Re: Sorting in a bar chart

thanks to  utkarsh and vignesh

• ###### Re: Sorting in a bar chart

hello  additional help , i have a situation here . we have now two dimenions

dottp1p2_enterprisesystem

monthdottp1p2

expression is

sum(days open)/ count(dottp1p2_enterprisesystem)

now when i use the sort expression

= count({<monthdottp1p2 = {"\$(vmonth_current)"}>}dottp1p2_enterprisesystem)

i am not getting the right values

previously the expression was count

now it is average .

• ###### Re: Sorting in a bar chart

You are not getting the right sorting order?

• ###### Re: Sorting in a bar chart

yes for this graph , i am not getting righ sort order

• ###### Re: Sorting in a bar chart

i belive in the previous expression we are using count , and in sort expression we are using Count({<Month= {"\$(vmonth"}>}Product) . but here i have a expression which is calculating average like

sum(days open)/ count(dottp1p2_enterprisesystem) , so i belive the sort expression is not working .