Forum Discussion
mysmsr
3 years agoFrequent Visitor
Dax help
Hello experts, Need help to write a new measure using DAX to calculate Rolling FC (Bias) where value gets calculated from a seleted month in the filter. Ex: bias month in this case is 3. Bias F...
- 3 years ago
Do you have a slicer to do the filtering? If so, what is the field you have used?
By reading the screencap of your calender table, maybe you can try the following:
Rolling Forecast Bias =IF(OR(MONTH(MAX('FY Table'[Month])) >= SELECTEDVALUE('Bias table'[Bias])+1,{{{ADD THE LOGIC THAT THE DATA YEAR IS LARGER THAN SELECTEDYEAR HERE}}}),[Rolling Forecast (13 WK)],0) - 3 years ago
mysmsr , perhaps you can try to see if this works.
Rolling Forecast Bias = VAR VirtualTable = SUMMARIZE(ALLSELECTED(FY Table), "Year",YEAR('FY Table'[Month]) ) VAR MinYear = VALUE(MINX(VirtualTable,[Year])) RETURN IF(OR(MONTH(MAX('FY Table'[Month])) >= SELECTEDVALUE('Bias table'[Bias])+1,YEAR(MAX('FY Table'[Month])) >= MinYear),[Rolling Forecast (13 WK)],0)
johnyip
3 years agoSolution Sage
cannot quite understand. what is your expected number of YTD actuals?
mysmsr
3 years agoFrequent Visitor
Sorry. My ytd actual should be a constant value of last(max) month rolling actuals which is 15598152. This value should be the same across all months. Hence I tried to capture MAX of rolling actuals in my dax code.
- johnyip3 years agoSolution Sage
Don't have the sample data and cannot test that. Please see if this works.
YTD Actuals = VAR MaxMonth = MAXX(ALLSELECTED('FY Table'),[Month]) VAR VirtualTable = SUMMARIZE(ALLSELECTED(FY Table), [Month], "Rolling Actual",[Rolling Actuals] ) VAR Rolling_Actuals = CONCATENATEX(VirtualTable,[Rolling Actual],"|") VAR Last_Rolling_Actual = PATHITEM(Rolling_Actuals,PATHLENGTH(Rolling_Actuals)) VAR Result = IF(MAX([Month]) <> BLANK(), Last_Rolling_Actual,BLANK()) RETURN Result