Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hello, I am in an odd situations.
I have created a calculations "Hours", it subtracts the working hours of the employees - the work received. But if it is referring to past weeks it subtracts the actual volume of work received, if it is referring to upcoming weeks it subtracts the estimated volume we will receive (which is included in another calculations). All good, my calculation is working. The strange fact is that, when I create another calculations that is calculating the accumulated backlog using the "Hours" calculations it doesn't work properly and values are wrong. This is because of the conditions applied in Hours, I know because if I remove that condition (if it is in the past use the actual volume, if in the future use the estimated volume) it works. The calculations is below:
Hours =
var myDate = weeknum(now()) var new_date = min ( 'calendar'[WeekNum] )
var val = if (myDate >= new_date, 1, 0)
var com = [Employees hours] - [Volume 2020] var expt = [Employees hours] - Merge1[Expected Volume]
return if(val = 1,com, expt)
calculation that is not working:
backlog =
var backlog_ = CALCULATE( [Backlog running total in Date], ALLSELECTED('calendar'[WeekNum]))
var date_max = CALCULATE(max ( 'calendar'[WeekNum] ))
var date_min = CALCULATE(min ( 'calendar'[WeekNum] ), ALLSELECTED('calendar'[WeekNum]))
var val = CALCULATE(
[Hours] ,
FILTER(
ALLSELECTED ( 'calendar' ),
'calendar'[WeekNum] >= date_min && 'calendar'[WeekNum] < date_max
)
)
var final = backlog_ - val return
if (final < 0, BLANK(), final)
any idea? i tried different workarounds but nothing, if the condition in "Hours" is applied it won't calculate the values in the rights way. Any help is appreciated. thank you in advance
hi @bbbt123
If possible, could you please share your sample pbix file and your expected output.
Please see this post regarding How to Get Your Question Answered Quickly:
https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490
Regards,
Lin
Hi cannot share the file as there are sensitive data. I will rephrase it providing more details and the desidered output. I have a calculation that is working, and it is counting the hours each employee will have to work on accumulated backlog, see below:
WeekNum | Backlog running total in Date | Remaining backlog | Hours employees will work on backlog |
5 | 63 | 63 | 0 |
6 | 63 | 82 | -19 |
7 | 63 | 108 | -26 |
8 | 63 | 57 | 51 |
9 | 63 | 37 | 20 |
10 | 63 | 4 | 33 |
11 | 63 | 0 | 32 |
For one thing I don't recommend using now()
Instead you should use Today() and Date.add when necessary.
I tried with today () but nothing changes, the thing is that if I use IF in the calculations, that calculations will work whereas any other calculations referring to the original one, will ignore the IF condition
Check out the July 2025 Power BI update to learn about new features.
User | Count |
---|---|
75 | |
71 | |
38 | |
29 | |
26 |
User | Count |
---|---|
97 | |
96 | |
60 | |
44 | |
41 |