Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
2 years ago
Solved

Bar chart showing same category twice erroneously

Hi All,

Could someone help figure out what could be the issue with the below chart? It's showing "3-6 Months" category twice for some reason - same with '>1 Year' category. I have also pasted the code but I don't see the issue with code - it's too basic. Has someone  faced a similar issue? Many thanks.

Code: - 

Overdue Status = IF('TableName'[Effort Code]=0,"Terminated",
SWITCH(TRUE(),
        'TableName'[Days Overdue]<=0, "Overdue",
        AND('TableName'[Days Overdue]>0, 'TableName'[Days Overdue]<30), "Due This Month",
        AND('TableName'[Days Overdue]>=30, 'TableName'[Days Overdue]<181), "3-6 Months",
        AND('TableName'[Days Overdue]>=181, 'TableName'[Days Overdue]<366), "6-12 Months",
        'TableName'[Days Overdue]>=366, "> 1 Year"  
 ))
  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi Ross,

    I found the answer. I had a separate column created using DAX called "Overdue Rank" which was used to sort the items of "Overdue Status" column in a specific order in the bar chart. apart from the ranking, both Overdue columns were based upon the same DAX coding as pasted in my original message. So here is what happened - I removed a few conditions from the switch formula of "Overdue Status" column (like when Days overdue are between 0 to 7, show status as "Due in 1 Week". However, I forgot to change the "Overdue Rank" column accordingly. Just when you mentioned there must be more going on here, I checked again and figured out. Thank you very much 🙂

6 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    This only happens if the text is different in some way.  For example one record might be "3-6 Months " but the others are "3-6 Months".  I would suggest in your Transform Data, on the column that holds these labels, do the tranformation "Trim".  You can find this by right clicking on the column.

     

    The TRIM should remove any extra spaces left over in your data during the import.

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi Ross, 
      Many thanks. I understand your point but if you notice in my DAX code, there is only one item labeled as '3-6 Months'. If I was using the same condition for more items, I could have used AND operator but that is not the case here. 

      • Anonymous's avatar
        Anonymous
        Not applicable

        There must be more going on than is shown in your screenshots. What other fields/measures are used here?  Is there a legend turned on?