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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
sumiteshkumar
Helper I
Helper I

need help: error in stacked bar chart representation using calculated column as legend

I have a PBI report where i am calculating the ops that got closed or going to get closed within 0-7 days from created date (Quick Closure within 0-7 days from creation date to close date), when i showing the data in table view, it shows correct data.

measure used to calculate Quick closure

Logic Quick Closure 0-7 =
SWITCH( TRUE(),
    DATEDIFF('pipeline'[CreatedOn], 'pipeline'[CloseDate], DAY) <= 7, "0-7 days",
    BLANK()
)

I am using same column measure as legend (Logic Quick Closure 0-7) in stacked bar chart, sales person name in y-axis, count of opportunity (distinct) in x axis, which shows wroung information.

error 1: the count of opportunity shows incorrect count

Amilcar has 10 ops in count but in stacked bar it shows 216

attached snapshot: error closure.png

error closure.png

error 2: when i am filtering data (stacked bar chart) which are going to close in currect quarter (Apr-Jun), then count of opportunity goes down but some of the names gets blank data in table view.

Jeremy has 31 in stacked bar chart, but it shows blank in table view

attached snapshot: error closure 1.png

error closure 1.png

 

1 ACCEPTED SOLUTION

Hi @sumiteshkumar ,
Thank you for sharing more details.I would be happy to assist you!

I tried to recreate it on my local with the sample data.
Please try using below calculated column :
QuickClosureGroup =
VAR DaysDiff = DATEDIFF('pipeline'[CreatedOn], 'pipeline'[CloseDate], DAY)
RETURN IF(DaysDiff <= 7 && NOT(ISBLANK('pipeline'[CloseDate])), "0-7 days", BLANK())

Attaching the file for your reference.

If this asnwer mees your requirement,consider accepting it as solution.

Regards,
Pallavi.


View solution in original post

9 REPLIES 9
v-pagayam-msft
Community Support
Community Support

Hi @sumiteshkumar ,
Could you please confirm if the issue has been resolvedon youe end? If a solution has been found, it would be greatly appreciated if you could share your insights with the community. This would be helpful for other members who may encounter similar issues.
Thank you for your understanding and assistance.

Thanks @v-pagayam-msft , issue solved

Hi @sumiteshkumar ,
Glad that your query got resolved.If so,consider accepting it as solution.

Thanks & Regards,
Pallavi.

v-pagayam-msft
Community Support
Community Support

Hi @sumiteshkumar ,
I wanted to check in on your situation regarding the issue. Have you resolved it? If you have, please consider marking the reply that helped you or sharing your solution. It would be greatly appreciated by others in the community who may have the same question.
Thank you.

danextian
Super User
Super User

Hi @sumiteshkumar 

 

Error 1 – Is the bar chart correctly filtered to show only the 0–7 days category? Or is it also including blank values?

Error 2 – This might still be connected to Error 1. Your table is filtered to display only 0–7 days, while the bar chart shows all values. Jeremy J has blank entries but none in the 0–7 days range.

 





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

@danextian, the data table has blank value, as we have calculated column that we are using as legend filter, which is 

Quick closure

Logic Quick Closure 0-7 =
SWITCHTRUE(),
    DATEDIFF('pipeline'[CreatedOn]'pipeline'[CloseDate]DAY) <= 7"0-7 days",
    BLANK()
)
 
i have filtered out blank from the bar chart, so that only 0-7 days ops can be shown, also i made a another filter where i am analysing top 10 sale person name with heighest count of ops

Hi @sumiteshkumar ,
Thank you for sharing more details.I would be happy to assist you!

I tried to recreate it on my local with the sample data.
Please try using below calculated column :
QuickClosureGroup =
VAR DaysDiff = DATEDIFF('pipeline'[CreatedOn], 'pipeline'[CloseDate], DAY)
RETURN IF(DaysDiff <= 7 && NOT(ISBLANK('pipeline'[CloseDate])), "0-7 days", BLANK())

Attaching the file for your reference.

If this asnwer mees your requirement,consider accepting it as solution.

Regards,
Pallavi.


pankajnamekar25
Super User
Super User

Hello @sumiteshkumar 

 

Create calculated column and then try

 

Quick Closure 0-7 (Column) =
VAR DaysDiff = DATEDIFF('pipeline'[CreatedOn], 'pipeline'[CloseDate], DAY)
RETURN
IF(DaysDiff <= 7, "0-7 days", BLANK())

 

Thanks

Pankaj

ribisht17
Super User
Super User

Need sample data

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 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