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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
Hasna95
Frequent Visitor

Duration of Days - Bar Chart in Power BI

Hi. 
So I am facing this issue, and I have not seen it anywhere. 
I basically have this table : 

PR NumberDepartmentPR StatusYearVendorDatePR Raised byPR Approved Date(LM)PR Approved Date(Procurement)SLA MetPurchase TypePR Order Creation Date
PR0001ProcurementOpen2024Vendor 119/06/2024John22/06/202422/07/2024NoRFP23/07/2024
PR0002OperationsOpen2024Vendor 231/01/2024Alice03/02/202428/02/2024NoRFQ29/02/2024
PR0003FinanceClosed2024Vendor 301/02/2024Bob10/02/202410/03/2024NoException10/03/2024
PR0004MarketingClosed2024Vendor 407/02/2024Carol15/02/202416/02/2024YesException18/02/2024
PR0005ITOpen2024Vendor 515/02/2024David18/02/202418/03/2024NoRFP

19/03/2024


I have 3 durations, I would like to show: 
1. Duration of days from Date to PR Approved Date (LM)
2. Duration of days from PR Approved Date (LM) to PR Approved Date (Procurement)
3. Duration of days from PR Approved Date (Procurement) to PR order Creation Date

I want to show these durations for each Purchase Type
Example: RFQ, RFP, and Exception.

So when I filter through Department or PR number, I can know what was all the 3 durations for each Purchase Type. 

I want something like this: 

Hasna95_0-1709284245408.png


I know I can recreate it bar chart or a matrix visual. But the issue I am facing is that, I have 3 durations for each Purchase Type. 
That's why it's not coming the way I want it to. 

Can you anyone suggest what I can do? 

7 REPLIES 7
Hasna95
Frequent Visitor

I did all that. 
I have this formula 

OverallStartDate Trial Measure =
MINX(
    SUMMARIZE(Trial, Trial[PR Number], "MinStartDate", MIN(Trial[MinStartDate])),
    [MinStartDate]
)
and this
Bar Shifting Days = SWITCH( TRUE(), Trial[Interval] = "LM Approved", Trial[Duration], Trial[Interval] = "Procurement Approved", DATEDIFF(Trial[From], Trial[To], DAY), Trial[Interval] = "Closed", DATEDIFF(Trial[From], Trial[To], DAY), BLANK() )

the issue is, if Closed is 1, instead of coming after the Procurement Approved It comes right under 0. 
Hasna95_0-1709724077246.png

Closed should come after Procurement Approved. 
I hope I am making sense.

 



and for duration, I have this formula. 

Duration = DATEDIFF('Table Demo'[From], 'Table Demo'[To], DAY)

After transforming the table, this is how it is structured. 
Hasna95_0-1709728311230.pngHasna95_1-1709728330297.png

 

Hasna95
Frequent Visitor

What I am looking for is basically, for each PR Number, I need to see the duration days from LM Approved, Procurement Approved and PO Creation Date (Clsoed)
I don't need the dates. I need the duration days rather similar to a gantt chart. But not sure how to structure my table. 

You can get that by summing the differences between From and To.

lbendlin
Super User
Super User

First step is to bring the data into a usable format

 

Project Purchase Type Interval type From To

 

Then use custom visuals like Deneb to show multiple date ranges in the same bar chart.

I'm not too sure if I understand you. 

Your data is not in a usable format.  It is coming from Excel where wide tables with many columns are common.  Power BI expects narrow tables with limited number of columns.  Unpivot your data with the headers that I suggested, or your own choice of headers. 

 

lbendlin_0-1709404373876.png

Then use Deneb to plot the data

 

lbendlin_1-1709404730871.png

 

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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

Top Solution Authors