Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
german_avanzato
Creator
Creator

Sort x-axis in chart with alternate state

Hi Everyone:

I have a problem in a chart, where two lines must be draw.

The expression for the first line is sum(Value) and the second one is sum({StateA}Value) where StateA is an alternate state.

The X-axis is a cycle group, with

- the concatenation of num(Month(Date),'#00')&'-'&num(Day(Date),'#00')&'-'&num(Hour(Date),'#00')

- the concatenation of num(Month(Date),'#00')&'-'&num(Day(Date),'#00')

- the Day

I dont put the year because I want to compare the information of different years.

The problem is that the X-axis don´t appear in orden.

I already try with the sort option, even with the expression option.

The problem is that when the state StateA expression is enable, the X-axis don´t appear sorted.

Is like the chart try to sort the x-axis for the 2 expression at the same time.

If I only let the StateA expression enable, the x-axis take the default sort option, don´t the sort option I set.

I need both expression enable,

Anyone know how to solve this?

Thanks

1 Solution

Accepted Solutions
german_avanzato
Creator
Creator
Author

I think I found the solution, but not in the sorting options.

I discovered in the field that is calculated with this expression

num(Month(Date),'#00')&'-'&num(Day(Date),'#00')&'-'&num(Hour(Date),'#00')

That some data are categorized like Text and others like number.

For that reason, I put the command Text()  to force the field to be recognize like Text

TEXT (num(Month(Date),'#00')&'-'&num(Day(Date),'#00')&'-'&num(Hour(Date),'#00') )

Now, with the default sort option, the axis is displaying the information in the correct way

Thanks for the help.

View solution in original post

3 Replies
Gysbert_Wassenaar

Can you post an example document that demonstrates the problem?


talk is cheap, supply exceeds demand
german_avanzato
Creator
Creator
Author

Hi @Gysbert Wassenaar

     Thanks for the Quick answer.

I upload the most reduce version that I could.

In the chart, (x-axis) you will see the cycle group, with:

- Mes Dia = Month Day

- Dia = Day

- Mes Dia Hora = Month Day Hour

If you want to sort the Month Day Hour, you can use the field "Orden", that have the correct order of the field.

german_avanzato
Creator
Creator
Author

I think I found the solution, but not in the sorting options.

I discovered in the field that is calculated with this expression

num(Month(Date),'#00')&'-'&num(Day(Date),'#00')&'-'&num(Hour(Date),'#00')

That some data are categorized like Text and others like number.

For that reason, I put the command Text()  to force the field to be recognize like Text

TEXT (num(Month(Date),'#00')&'-'&num(Day(Date),'#00')&'-'&num(Hour(Date),'#00') )

Now, with the default sort option, the axis is displaying the information in the correct way

Thanks for the help.