Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
Anonymous
Not applicable

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.

Error-BarChart-PBI.JPG

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"  
 ))
1 ACCEPTED SOLUTION
Anonymous
Not applicable

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 🙂

View solution in original post

6 REPLIES 6
RossEdwards
Solution Sage
Solution Sage

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
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. 

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?

Anonymous
Not applicable

Hi Ross,
Days Overdue is a calculated column in Power Query based upon Expiry Date's difference from Today's date. Then I created Overdue Status column based upon the value of 'Days Overdue' using a Switch statement in DAX.  Does this help?

That tells us how the column containing "Overdue Status" has come about, which on its own shouldn't cause whats occuring in the graph.  What else is included in this graph, its a count of something.  Does the visual have a legend?  Does the issue still occur if you save and quit and reopen Power BI?

Anonymous
Not applicable

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 🙂

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors