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
Anonymous
Not applicable

Calculating Percentage time remaining

Hi

 

I am trying to create a Measure to work out a percentage of time remaining on a project, this takes into account todays date.  All the data in in a single table.  The table has many rows, the difference is they have a varied budgets amounts but they all share the same 'Code', and same 'Start' and 'End' date.  I can created a calculated columns hoping this would help but my calculation just throughs out odd amounts; I am sure its becase there is the same value for each code per row.  I cant groupby the table, this is my sample:

 

Sample DataSample Data

 

So I was aiming to create ameasure that when I select the code 'ABC' in a matrix or pivot, I just get "-1%", but it does some thing alltogether and seems to add up numerous values.  

 

I have tried formula like: SUMX('TableA', sum('TableA'[Remaining Days')/sum('TableA'[Project No Of Days]))

 

I alos attempted a separte measure for calculatign the "no of days" rather than a calculated column, but again odd results, sample forulmula like this: SUMX('TbaleA', sum('TableA'[End Date')-SUM('TableA'[Start Date]))

 

Is it something to do with 'Row Context' maybe?  There is no filter contect, that I know of.   What am I doing wrong, in theory its a simple calculation?

 

Chris

1 ACCEPTED SOLUTION

@Anonymous 

You need two measures:

Remaining Days = 

INT(TODAY() - MAX(Project[End date]))
% Remaining = 

DIVIDE(
    [Remaining Days],
    MAX(Project[Project No of days])
)

 

Fowmy_0-1598300184334.png

 

________________________

Did I answer your question? Mark this post as a solution, this will help others!.

Click on the Thumbs-Up icon if you like this reply 🙂

YouTube, LinkedIn

 

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

View solution in original post

5 REPLIES 5
amitchandak
Super User
Super User

@Anonymous , Try like

avergageX(summarize(Table, Table[code],Table[StartDate],Table[endDate],"_1", max(Table[project no of Days]), "_2",max(Table[remaining Days])), divide([_2],[_1]))
Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Fowmy
Super User
Super User

@Anonymous 

What is your expected results ? Can you show it for  one code?

Can you try this :

 

m = 

SUMX('TableA', 
DIVIDE(
    'TableA'[Remaining Days],
    'TableA'[Project No of days])
)

 

 



________________________

Did I answer your question? Mark this post as a solution, this will help others!.

Click on the Thumbs-Up icon if you like this reply 🙂

YouTube, LinkedIn




Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Anonymous
Not applicable

Hi Fowmy

 

This is the results I get:

codeStart DateEnd dateProject No of daysThis is what it should be  ::Remaining DaysThe resulst I want ::Time remaining %New Measure
ABC05/09/201604/08/20201429-20-1%-5%
ZZZ01/05/200831/12/2008244-4254-1743%-15752%
AAA01/12/201930/11/20203659827%27%
EFG01/07/201830/12/202091312814%127%

 

The colums in Green is what I am tryign to acheive.

The column in Blue is what I am am trying to acheive.

The column in Red is the new measure, its getting there slowly.

 

I made sure all the values come from the same table, trying to remove an filter context.  I may need to rethink my how I am doing calculations, these are based around todays date.

 

Alos even though not inlustrated, onthe source tabel theerare several rows for ABC, ZZ etc, here I am just showing one line for simplicity.

 

Project No of Days = start date-end date

Remaining Days = End Date - Today()

% Time Remaining Measure = Remaining Days / Project No of Days

 

Chris

@Anonymous 

You need two measures:

Remaining Days = 

INT(TODAY() - MAX(Project[End date]))
% Remaining = 

DIVIDE(
    [Remaining Days],
    MAX(Project[Project No of days])
)

 

Fowmy_0-1598300184334.png

 

________________________

Did I answer your question? Mark this post as a solution, this will help others!.

Click on the Thumbs-Up icon if you like this reply 🙂

YouTube, LinkedIn

 

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Anonymous
Not applicable

Fowmy

 

Looking better thanks.  I also need to calculate a % percentage through the budget but I will use the examples posted here to work that part out.

 

Cheers Again.

Chris

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.