1

I have a filter function in combination with the CHOOSECOLS, SORT and IFERROR function. I use this to draw a dynamic graph in Excel. At first it seems to work fine. However when I select values that have no data (resulting in "-- No Result --" on screen) the graph breaks.

Because after I have the message on screen ("-- No Result --") and I select other values that do have a result, the graph stays empty. How can I solve this?

=IFERROR(CHOOSECOLS(SORT(FILTER(tbDataManager;(tbDataManager[ICT-service]=Application)*(tbDataManager[Rapport period]>=StartPeriod)*(tbDataManager[Rapport period]<=EndPeriod);"");2;1);1;2;3;4;7;6;8);"-- No Result--")

The input is the ICT-Service and a start- and enddate resulting in a filtered table. I select the columns of this table I want to show in a graph. In this case a line graph.

Result with data

Result when there is no data

As said, when I select valid data after I have had the No Result message, the graph stays empty where it should show the graph again, because this time I have data.

Steps:

  1. Select values that result in data, graphs shows fine (correct).
  2. Select values that result in No Data, graph shows No Data (correct)
  3. Select values that result in data, graph stays empty (Not correct it should show the lines because there is data to show)

UPDATE (20250820 10:30)

I notice that when there is only one line to show, the graph didn't show anything and was broken. I found that this was cause by the type of graph (Line graph). Now I have a Line graph with markers. In this case when only one records results from the filter function, the graph keeps working and when I select an other value that results in multiple records, the graph still works fine.

The only time it is still going wrong is when there is nothing to show (using NA() or "" doesn't matter). In this case when I select an other value that does have a result after I pervious had an empty result, the graph won't show anything anymore. It seems like the series and categories have been reset and stay that way after an empty value was the result of the filter function.

UPDATE (20250820 13:30):

I did some more investiogation and I found that part of the problem was the inconstency of the source. The Periode column is in a format of yyyy-q but some of the row didn't have the q defined. So in my case I replace all the empty Q's with 1 in order to have a valid value for all the rows.

Based on Solar Mike's suggestion, also replace the [empty part] of the FILTER function with NA and removed the IFERROR part of the function.

I also found that it is a problem when the data used to draw the graph cannot have a column in between that is not used to draw the graph like

Source and Graph

The first two columns I use for the series and the last two for the line drawing. So column 3 and 4 are not used here. This also caused also a problem, because when selecting a value that results in a NA value and after this selecting a valid value, the graph doesn't show anymore it stays empty no matter what I select. So I had to alter the function and leave these columns out so that the series values and data values are next to each other. Don't know is this is normal behaviour.

The only problem remaining now is when a value is select that has no result (NA), resulting in an empty graph and after I select a valid value again the Legend Entries and Horizontal labels are switched. So I got a different graph showing.

Normal graph

Emtpy value result

Valid data but labels and series are swichted

8
  • The graph behave as it should. When, there is no data then graph can't show anything. What do you want to show in graph when the output is No result? Commented Aug 19 at 4:45
  • You misunderstood the question. The graph behaves fine, but once I have a No Result result and AFTER that I select values that DO have a result. The graph stays empty where one would expect that the graph would show the result instead of staying empty. Commented Aug 19 at 5:11
  • I just tried the three steps with some dummy data and it works OK. Just to clarify, does the 'No result' message display as part of the empty graph in step 2? Commented Aug 19 at 8:35
  • That's correct Tom. It is part of the IFERROR as you can see in the formula. Could you share you file? Commented Aug 19 at 9:28
  • So replace the "no result" with NA(), see stackoverflow.com/a/78133071/4961700 and give it a vote if it helps. Commented Aug 19 at 10:37

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.