The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hey guys, I need help in fixing my formula.
Basically I have a table which contains Forecast hours and Spend hours. When the Spend Hours has a value it overrules the Forecast Hours.
I want to calculate the deviation between Forecast en Spend and use that percentage to calculate the total hours spend at the end.
But my result keeps giving a (empty) when I know that is wrong because I have the data in my table.
I've tried changing the 0 to BLANK() but no result
Test2 =
var cal = SUMX(FILTER(ALL('FC Uren'),'FC Uren'[Geboekte uren]=0),'FC Uren'[Forecast uren])
var act = SUMX(FILTER(ALL('FC Uren'),'FC Uren'[Geboekte uren]<>0),'FC Uren'[Geboekte uren])
var dev = 1+IF(ISNUMBER(SELECTEDVALUE('FC Uren'[Geboekte uren])),(act-cal)/cal)
return
IF([Totaal geboekte uren]<>0,
dev*SELECTEDVALUE('FC Uren'[Forecast uren]))
@Adamboer I'm not sure If I was clear enough in my question. So let me try it again and hopefully I can communicate what it is that I want.
Alle the pieces of data you see are in the same table called FC uren
Want I'm trying to do is to calculate the deviating between Geboekte uren en Forecast uren.
In the beginning I make a forecast for how many hours I think i'm gonna need (Forecast uren) and then I start the project and then I get actual hours (Geboekte uren). In the picture below in Column Test3 I want to see the amount of Geboekte uren when there is data but when there isn't any data (starting in 2023-W16) it should do the following.
First we need to calculate the deviation in the weeks when I have values in Geboekte uren.
So for example:
Between 2023-W11 and 2023-W15 I have used (Geboekte uren) 72,75 hours but i've forecasted 75 hours (5x15 hours) so there is a deviation of 3% (75/72,75=1,03)
Starting in 2023-W16 (where there isn't a value for Geboekte uren) I want test3 to display (15 hours + 3% 😃 15,45 hours
@RonaldvdH First you open to measure 'FC Uren'[Geboekte uren] and endResult + 0 for E.g sum(Geboekteuren)+0.
similer to [Totaal geboekte uren] this measure, i hope this will help you for correct result.
>>Can you show me a screenshot of the table 'FC Uren' and what's inside the measure [Totaal gebokte uren] and
'FC Uren'[Geboekte uren]?
@Mahesh0016 here is the screenshot for FC Uren
The formula in the measure 'Totaal geboekte uren' is
Totaal geboekte uren = CALCULATE(SUM('DWH Uren'[PT Taakuren]),USERELATIONSHIP('FC Uren'[Week+Kenmerk],'DWH Uren'[Week+Kenmerk]))
The calculted column is based on a vertical search from another table
Geboekte uren = VAR __Kenmerk1 = 'FC Uren'[Week+Kenmerk]
VAR __Kenmerk2 = FILTER(ALL('test2'),test2[Weeknummer TD datum+Activiteit] = __Kenmerk1)
RETURN
MAXX(__Kenmerk2,[Aantal geboekte uren])
To further clarify my question I've made this screenshot.
For that specific project I think we'll use 15 hours per week but in reality we've used 17, 16.75, 13 and 19,5 hours.
That means, based on the 15 hours I've forecasted I have a deviation
Test2 =
var cal = SUMX(FILTER(ALL('FC Uren'),'FC Uren'[Geboekte uren]=0),'FC Uren'[Forecast uren])
var act = SUMX(FILTER(ALL('FC Uren'),'FC Uren'[Geboekte uren]<>0),'FC Uren'[Geboekte uren])
var dev = 1+IF((SELECTEDVALUE('FC Uren'[Geboekte uren]*1)>0),(act-cal)/cal,0)
return
IF([Totaal geboekte uren]<>0,
dev*SELECTEDVALUE('FC Uren'[Forecast uren]))
@tt_and that formula returns an error
A single value for the column 'geboekte uren'in the tabel FC uren could not be determined
Oh, sorry, haven't tested it. What about
Test2 =
var cal = SUMX(FILTER(ALL('FC Uren'),'FC Uren'[Geboekte uren]=0),'FC Uren'[Forecast uren])
var act = SUMX(FILTER(ALL('FC Uren'),'FC Uren'[Geboekte uren]<>0),'FC Uren'[Geboekte uren])
var dev = 1+IF((SELECTEDVALUE('FC Uren'[Geboekte uren])*1)>0,(act-cal)/cal,0)
return
IF([Totaal geboekte uren]<>0,
dev*SELECTEDVALUE('FC Uren'[Forecast uren]))
Oh, sorry. With max() around selectedvalue it should work?
I've made the changes you suggested but still I get an error
the function MAX only accepts a columnreference as argument
Test2 =
var cal = SUMX(FILTER(ALL('FC Uren'),'FC Uren'[Geboekte uren]=0),'FC Uren'[Forecast uren])
var act = SUMX(FILTER(ALL('FC Uren'),'FC Uren'[Geboekte uren]<>0),'FC Uren'[Geboekte uren])
var dev = 1+IF((SELECTEDVALUE('FC Uren'[Geboekte uren])*1)>0,(act-cal)/cal,0)
return
IF([Totaal geboekte uren]<>0,
dev*MAX(SELECTEDVALUE('FC Uren'[Forecast uren])))
Hi. Can you show me a screenshot of the table 'FC Uren' and what's inside the measure [Totaal gebokte uren]?